tree abcd/ -a
abcd/
├── .abc
├── ddda
├── .foo
└── test
└── gg
└── .abcd
$ rsync -avh abcd/ test
sending incremental file list
./
.abc
ddda
.foo/
test/
test/gg/
test/gg/.abcd
sent 373 bytes received 96 bytes 938.00 bytes/sec
total size is 20 speedup is 0.04
---------------------------------------------
$ rsync -avh abcd test1
sending incremental file list
created directory test1
abcd/
abcd/.abc
abcd/ddda
abcd/.foo/
abcd/test/
abcd/test/gg/
abcd/test/gg/.abcd
sent 386 bytes received 125 bytes 146.00 bytes/sec
total size is 20 speedup is 0.04
-----------------------------------------------------
$ rsync -avh abcd/* test2
sending incremental file list
created directory test2
ddda
test/
test/gg/
test/gg/.abcd
sent 254 bytes received 98 bytes 704.00 bytes/sec
total size is 14 speedup is 0.04
在source dir 用 DIRA/* 會掉 .開頭的file folder
tree -a abcd/ test test1 test2
abcd/
├── .abc
├── ddda
├── .foo
└── test
└── gg
└── .abcd
test
├── .abc
├── ddda
├── .foo
└── test
└── gg
└── .abcd
test1
└── abcd
├── .abc
├── ddda
├── .foo
└── test
└── gg
└── .abcd
test2
├── ddda
└── test
└── gg
└── .abcd
參考
https://unix.stackexchange.com/questions/178078/how-to-rsync-a-directory-to-a-new-directory-with-different-name
How to rsync a directory to a new directory with different name
If you want to use rsync to recursively make the dest directory an exact copy of the src directory:
rsync -a src/ dest
linux os version
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
沒有留言:
張貼留言