rsync在本地备份期间丢失了一个文件夹

时间:2013-11-28 07:46:25

标签: linux rsync

当我使用以下脚本在本地备份文件夹时,将省略子文件夹“core”:

mkdir {gsp,dst} 
svn co http://10.0.2.59:8118/svn/gsp/Development-Area/3-SCL/Trunk/TaskServer_Gsp gsp
rsync -auC gsp/* dst/
diff -rq gsp dst

输出结果为:

Only in gsp/com.boco.gdpp.taskserver.core/src/com/boco/gdpp/taskserver: core
Only in gsp: .svn

rsync命令的返回值为0,表示没有错误。以下是文件夹“gsp”和“dst”的结构,“核心”不是最深的子文件夹。为什么“核心”无法复制到“dst”?

tree -d gsp

gsp
|-- com.boco.gdpp.taskserver.core
|   |-- lib
|   |-- META-INF
|   |   `-- spring
|   `-- src
|       `-- com
|           `-- boco
|               `-- gdpp
|                   `-- taskserver
|                       |-- config
|                       |   `-- exports
|                       |       `-- exceptions
|                       |-- core
|                       |   |-- changenode
|                       |   |   |-- element
|                       |   |   `-- process
|                       |   `-- task
|                       |       `-- util
|                       |-- export
|                       |   |-- bean
|                       |   |   |-- enums
|                       |   |   `-- processdef
|                       |   `-- util
|                       |       `-- processtree
|                       `-- msg
|                           `-- support
|-- com.boco.gdpp.taskserver.gsp.gworkflow
|   |-- libs
|   |-- META-INF
|   |   `-- spring
|   `-- src
...(more folders)

94 directories

tree -d dst
dst
|-- com.boco.gdpp.taskserver.core
|   |-- lib
|   |-- META-INF
|   |   `-- spring
|   `-- src
|       `-- com
|           `-- boco
|               `-- gdpp
|                   `-- taskserver
|                       |-- config
|                       |   `-- exports
|                       |       `-- exceptions
|                       |-- export
|                       |   |-- bean
|                       |   |   |-- enums
|                       |   |   `-- processdef
|                       |   `-- util
|                       |       `-- processtree
|                       `-- msg
|                           `-- support
|-- com.boco.gdpp.taskserver.gsp.gworkflow
|   |-- libs
|   |-- META-INF
|   |   `-- spring
|   `-- src
...(more folders)

88 directories

1 个答案:

答案 0 :(得分:3)

-C选项会导致rsync忽略与各种模式匹配的文件和目录,其中包括core。此名称通常用于进程故障转储文件。从手册页:

The exclude list is initialized to:

    RCS SCCS CVS CVS.adm RCSLOG cvslog.* tags TAGS .make.state .nse_depinfo *~ #* .#* ,*  _$*  *$  *.old  *.bak  *.BAK
    *.orig *.rej .del-* *.a *.olb *.o *.obj *.so *.exe *.Z *.elc *.ln core .svn/

您可以使用以下方式覆盖此内容:

--include=core