0

server1 has a filename.tgz and I need to copy it to server2. I would like to keep daily copies on server2, like:

/backup/Mon/filename.tgz
/backup/Tue/filename.tgz
...
/backup/Sun/filename.tgz

I have been reading the rsync man page, but I'm not clear on whether I should use the --backup-dir option or the --copy-dest option

I'll have a command similar to

rsync -av --copy-dir=../`date -d yesterday +%a` filename.tgz dest:/backup/`date +%a`/

1 Answer 1

2

I think you're overthinking it. rsync will automatically create directories, so you can just do:

rsync -v filename.tgz server2:/backup/`date -d yesterday +%a`/

Make sure you have the trailing slash, or the backup file will be called the day of the week instead.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .