rsync -a --exclude={'file1.txt','dir1/*','dir2'} src_directory/ dst_directory/ 如果要排除的文件或目录数量很大,则可以在一个文件中列出要排除的文件与目录,然后将文件传递给--exclude-from选项。 rsync -a --exclude-from='exclude-file.txt'src_directory/ dst_directory/ file1.txt dir1/* di...
3)将dirA的所有文件同步到dirB,但是在dirB内除了fileB3.txt这个文件不删之外,其他的都删除。 $ rsync -avz --delete --exclude "fileB3.txt" dirA/ dirB/ sending incremental file list ./ deleting fileB2.txt deleting fileB1.txt fileA1.txt fileA2.txt fileA3.txt sent 203 bytes received 72 byt...
rsync -av source_file user@host:destination_folder – 从远程主机复制文件到本地: rsync -av user@host:source_file destination_folder – 本地复制时排除某些文件或文件夹: rsync -av –exclude ‘pattern’ source_folder destination_folder – 本地复制时删除目标目录中不存在的文件: rsync -av –delete ...
--exclude-from或类似的排除您可能不需要的文件将减少时间,但不会增加传输速度。 -S/--sparse:将空序列变成稀疏块 --partial或者-P是--partial --progress:保存任何部分传输的文件以供将来恢复。注意:文件不会有临时名称,因此请确保在整个副本完成之前,没有其他期望使用目标的文件。 --no-whole-file这样需要重新...
-x, --one-file-system: 不要跨越文件系统边界。 -B, --block-size=SIZE: 检验算法使用的块尺寸,默认是700字节。 -e, --rsh=command: 指定使用rsh、ssh方式进行数据同步。 --rsync-path=PATH: 指定远程服务器上的rsync命令所在路径信息。 -C, --cvs-exclude: 使用和CVS一样的方法自动忽略文件,用来排除...
rsync -av --exclude “checkout”yjwan@172.16.251.241:/home/yjwan/bashshell/tmp 将不会复制这个文件夹 [root@free /tmp/bashshell]# ls -d /tmp/bashshell/checkout ls: /tmp/bashshell/checkout: No such file or directory 注意: 1事实上,系统会把文件和文件夹一视同仁,如果checkout是一个文件,...
rsync -av –exclude “checkout”yjwan@172.16.251.241:/home/yjwan/bashshell /tmp 将不会复制这个文件夹 [root@free /tmp/bashshell]# ls -d /tmp/bashshell/checkout ls: /tmp/bashshell/checkout: No such file or directory 注意: 1 事实上,系统会把文件和文件夹一视同仁,如果 checkout 是一个...
1、这个路径必须是一个相对路径,不能是绝对路径。不可写为--exclude /testuser。 2、系统会把文件和文件夹一视同仁,如果testuser是一个文件,同样不会复制。 3、如果想避开复制testuser里面的内容,可以这么写--exclude testuser/file1, 4、可以使用通配符 避开不想复制的内容 ...
3)将dirA的所有文件同步到dirB,但是在dirB内除了fileB3.txt这个文件不删之外,其他的都删除。 $ rsync -avz --delete --exclude "fileB3.txt" dirA/ dirB/ sending incremental file list ./ deleting fileB2.txt deleting fileB1.txt fileA1.txt ...
登录后复制rsync -a -P remote_user@remote_host_or_ip:/opt/media/ /opt/media/ 排除文件和目录 当你要排除文件或目录时,您需要使用源目录的相对路径。有两种方式可以排除文件和目录。 第一种方式是使用登录后复制rsync命令的登录后复制--exclude选项,在命令行指定要排除的文件和目录。--exclude选项可以重复使...