zoukankan      html  css  js  c++  java
  • rsync同步目录

    -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
    -r, --recursive             recurse into directories
    -l, --links                 copy symlinks as symlinks
    -p, --perms                 preserve permissions
    -t, --times                 preserve modification times
    -g, --group                 preserve group
    -o, --owner                 preserve owner (super-user only)
    -D                          same as --devices --specials
        --devices               preserve device files (super-user only)
        --specials              preserve special files
        
    -H, --hard-links            preserve hard links
    -A, --acls                  preserve ACLs (implies -p)
    -X, --xattrs                preserve extended attributes
    
    
    -P                          same as --partial --progress
    --partial
                  By  default,  rsync  will  delete  any partially transferred file if the transfer is interrupted. In some circum‐
                  stances it is more desirable to keep partially transferred files. Using the --partial option tells rsync to  keep
                  the partial file which should make a subsequent transfer of the rest of the file much faster.
                  断点续传
    --progress
                  This option tells rsync to print information showing the progress of the transfer. This gives a bored user  some‐
                  thing  to  watch.   With  a  modern  rsync  this  is  the same as specifying --info=flist2,name,progress, but any
                  user-supplied settings for those info flags takes precedence (e.g. "--info=flist0 --progress").
                  显示传输进度
                  
                  
    -v, --verbose
                  This  option increases the amount of information the daemon logs during its startup phase.  After the client con‐
                  nects, the daemon’s verbosity level will be controlled by the options that the client  used  and  the  "max  ver‐
                  bosity" setting in the module’s config section.
                  输出详细信息
                  
                  
    --delete
                  This tells rsync to delete extraneous files from the receiving side (ones that aren’t on the sending  side),  but
                  only  for  the  directories  that  are being synchronized. 
                
    推荐用法:
    rsync -aP  --delete . /tmp/20180619/
    rsync -av  --delete --progress . /tmp/20180619/


    [root@prdweb02 ~]# ll | grep tes
    -rw-r--r-- 1 root root 139351040 Dec 25 11:48 kubernetes-dashboard-amd64.tgz
    drwxr-xr-x 3 root root 92 Feb 20 18:06 test_compose

    源目录后加/则只会把这个目录下的内容复制过去

    [root@prdweb02 ~]# rsync -aP  --delete test_compose/ /tmp/20180619/

    源目录后不加/则会把这个目录本身也复制过去

    [root@prdweb02 ~]# rsync -aP  --delete test_compose /tmp/20180619/

  • 相关阅读:
    MySQL的sql_mode合理设置
    Redis
    启动Jupyter Notebook提示ImportError: DLL load failed: 找不到指定的模块。
    Linux目录结构
    修改mysql密码报错: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '
    springmvc运行原理
    博客园美化
    数据搜索
    git
    window
  • 原文地址:https://www.cnblogs.com/goozgk/p/9201732.html
Copyright © 2011-2022 走看看