zoukankan      html  css  js  c++  java
  • rsync 排除指定目录

    背景

    将Server1上的数据同步到Server2;

    Server1目录结构:

    /us_data/yahoo
                 └── qlib
                        ├── calendars
                        ├── dataset_cache
                        ├── features
                        ├── features_cache
                        └── instruments                    

    Server2目录结构:

    data
       └── us_qlib_data
                      └── yahoo
                   
    └── qlib

    我需要将 Server1 里的 qlib 传到 Server2 yahoo 目录下;

    并且 Server1Server2 传时排除 dataset_cachefeatures_cache 这两个目录;

    rsync代码

    主要使用了 rsync 的 --exclude 参数

    rsync -Lrza /data2/pezhu/us_data/yahoo/qlib/ --exclude dataset_cache/ --exclude features_cache/  Server2用户名@Server2的IP:/data/us_qlib_data/yahoo/qlib
    
    # 执行后,会提示输入Server2 的密码,输入即可

    我直接用python 中 os.system() 执行了代码:

    rsync -Lrza /data2/pezhu/us_data/yahoo/qlib/ --exclude dataset_cache/ --exclude features_cache/  Server2用户名@Server2的IP:/data/us_qlib_data/yahoo/qlib
  • 相关阅读:
    C++中使用stringstream进行类型转换操作
    代理模式
    观察者模式 VS 责任链模式
    10.模板方法模式
    2.里氏替换原则
    单一职责原则
    规格模式
    策略模式的扩展——策略枚举
    策略模式 VS 桥梁模式
    原型模式【下】
  • 原文地址:https://www.cnblogs.com/bigtreei/p/11763865.html
Copyright © 2011-2022 走看看