简体   繁体   中英

unix: move files and keep folder structure

Linux 2.6.18-194.el5 x86_64

I have two folders with files with the same structure:

I would like to move all files from FTP_UPD to FTP keeping folder structure.

FTP_UPD
├── cat1
│   ├── und3
│   └── und4
└── cat2
    ├── und1
    └── und2

FTP
├── cat1
│   ├── und3
│   └── und4
└── cat2
    ├── und1
    └── und2

I tried with

rsync -a --progress --remove-source-files FTP_UPD FTP

but I get error:

rsync: --remove-source-files: unknown option
rsync error: syntax or usage error (code 1) at main.c(1231) [client=2.6.8]

Maybe any other options? Please help me with this.

Use this:

mv FTP_UPD FTP

This will simply move the folder. You could also call rename instead of move.

If you want to keep the old FTP_UPD folder with its contents:

cp -r FTP_UPD FTP

-r parameter causes recursive copying (copying everything that is inside FTP_UPD ). This can also be read from man cp .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM