zoukankan      html  css  js  c++  java
  • rsync --exclude 参数

    /usr/bin/rsync -vr --exclude=".svn" --exclude="temp" --delete /alidata/www/pro/ecshop/ /alidata/www/crontal/ecshop
    

     同步 除.svn  和temp  之外的文件

    rsync 命令选项 源目录 目标目录
    
    假如源目录写为 /var/www/就会把该目录下所有文件同步到目标目录,如果写为/var/www/*,那么当前目录下的隐藏文件(文件夹名或文件名是以”.”号开头)则不会被同步,不过子目录中的隐藏文件还是会被同步。
    
    假设需要排除某个文件(或文件夹),可以用–exclude来指定,例如需要排除源目录下的dir1文件夹,可以写为:
    /usr/bin/rsync -vzrtopg –exclude=dir1 /var/www/src/ /var/www/dest
    
    可以同时排除多条,例如:
    /usr/bin/rsync -vzrtopg –exclude=dir1 –exclude=dir2 /var/www/src/ /var/www/dest
    
    除了上述方法,还可以通过–exclude-from来指定,例如:
    /usr/bin/rsync -vzrtopg –exclude-from=exclude.list /var/www/src/ /var/www/dest
    
    exclude.list文件中指定需要排除的列表,例如:
    dir1
    [0-9]*
    dir2/.[a-z0-9]*
    .svn
    

     ------------------------------->实例

    /usr/bin/rsync -vr --exclude=".svn" --exclude="temp/*" --exclude="data/config.php" --exclude="mobile/data/*" --exclude="mobile/include/base/constant.php"  --delete /alidata/www/pro/ecshop/ /alidata/www/crontal/ecshop
    

     可见都是相对路径

    root@(none):~/svnclient/ecshop# la -a
    .                     api              cert                   diy.php           feed.php          includes     pick_out.php   snatch.php     wap
    ..                    api.php          certi.php              dl_receiver.php   flash_sale.php    index.php    pm.php         .svn           wholesale.php
    activity.php          article_cat.php  chinabank_receive.php  doc               flow.php          js           quotation.php  tag_cloud.php  widget
    admin                 article.php      comment.php            ecmoban_qq        gallery.php       languages    receive.php    temai.php      xxzz
    affiche.php           auction.php      compare.php            ecs_template.frm  goods.php         message.php  region.php     temp
    affiliate.php         brand.php        cycle_image.php        ecs_template.MYD  goods_script.php  mobile       respond.php    themes
    alipay.html           captcha.php      data                   ecs_template.MYI  group_buy.php     myship.php   robots.txt     topic.php
    allcate.php           catalog.php      delete_cart_goods.php  exchange.php      htaccess.txt      package.php  search.php     user.php
    animated_favicon.gif  category.php     denglu.php             favicon.ico       images            phpinfo.php  sitemaps.php   vote.php
    root@(none):~/svnclient/ecshop# pwd
    /root/svnclient/ecshop
    
    root@(none):~/svnclient/ecshop# ecshop 下的 data/config.php temp/* mobile/data/* mobile/include/base/constant.php 不会被同步
    


     

  • 相关阅读:
    Sublime Text3快捷键大全
    IntelliJ IDEA常用快捷键(Mac)
    shell脚本执行错误 $' ':command not found
    Shell脚本中"command not found"报错处理
    Shell 数值、字符串比较
    Java线程池的构造以及使用
    Host 'xxx' is not allowed to connect to this MySQL server
    Linux下Mysql安装(tar安装)
    Linux下Mysql安装(RPM安装)
    Mac安装Mysql
  • 原文地址:https://www.cnblogs.com/bass6/p/5542079.html
Copyright © 2011-2022 走看看