ubuntu – 通过sshfs的Rsync跳过以下划线开头的文件名

前端之家收集整理的这篇文章主要介绍了ubuntu – 通过sshfs的Rsync跳过以下划线开头的文件名前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试将OS X(10.11)中的目录树同步到Ubuntu 14.04.虽然大多数文件传输得很好,但名称以_(下划线)开头的文件却没有.

这是我使用的命令:

rsync -rtvh --progress ~/Pictures/processed/ ~/mnt/processed/

以及输出的一个例子:

sending incremental file list
_MG_7425.jpg
      4.66M 100%  169.79MB/s    0:00:00 (xfr#1,to-chk=58/60)
_MG_7427.jpg
      6.59M 100%  103.07MB/s    0:00:00 (xfr#2,to-chk=57/60)
...
rsync: mkstemp "/Users/user/mnt/processed/._MG_7425.jpg.0cAYb3" Failed: No such file or directory (2)
rsync: mkstemp "/Users/user/mnt/processed/._MG_7427.jpg.5Gw1vD" Failed: No such file or directory (2)

sent 306.24M bytes  received 9.46K bytes  122.50M bytes/sec
total size is 306.17M  speedup is 1.00
rsync error: some files/attrs were not transferred (see prevIoUs errors) (code 23) at main.c(1249) [sender=3.1.2]

我的rsync是从自制软件安装的,版本信息:

rsync  version 3.1.2  protocol version 31
Copyright (C) 1996-2015 by Andrew Tridgell,Wayne Davison,and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files,64-bit inums,64-bit timestamps,64-bit long ints,socketpairs,hardlinks,symlinks,IPv6,batchfiles,inplace,append,ACLs,xattrs,iconv,symtimes,no prealloc,file-flags

使用sshfs挂载远程位置:

sshfs -o idmap=user username@hostname:/some/path ~/mnt -o auto_cache,reconnect,defer_permissions,noappledouble

使用cp命令复制其中一个跳过的文件成功.我尝试添加–iconv = utf-8-mac,utf-8和–include’_ *’选项,这些选项无效.

我究竟做错了什么?

事实证明罪魁祸首是sshfs标志.我用来摆脱.DS_Store文件的noappled double标志实际上干扰了rsync的工作.

sshfs Mount Options docs:

noappledouble

This option makes osxfuse deny all types of access to Apple Double (._) files and .DS_Store files. Any existing files will become apparently non-existent. New files that match the criteria will be disallowed from being created.

正如它所指出的,该选项还涉及._ name前缀,这正是rsync用于其临时文件的原因:

rsync: mkstemp "/Users/user/mnt/processed/._MG_7425.jpg.0cAYb3" Failed: No such file or directory (2)

因此,当mkstemp创建临时文件时,sshfs会干扰并阻止它的创建.

从sshfs安装命令中删除noappledouble选项修复了问题,_ *文件已被转移.

感谢@Halfgaar指出我正确的方向.

猜你在找的Ubuntu相关文章