[rsync] --backup and --backup-dir options

whired123

Member
Joined
Nov 15, 2021
Messages
71
Reaction score
4
Credits
539
Bash:
$ tree
└── orig
    └── file

$ touch orig/file && rsync -ai --backup --backup-dir=orig~ orig backup
created directory backup
cd+++++++++ orig/
>f+++++++++ orig/file

$ tree
├── backup
│   └── orig
│       └── file
└── orig
    └── file

$ touch orig/file && rsync -ai --backup --backup-dir=orig~ orig backup
>f..t...... orig/file

$ tree
├── backup
│   ├── orig
│   │   └── file
│   └── orig~
│       └── orig
│           └── file
└── orig
    └── file

$ rm -rf backup && tree
└── orig
    └── file

$ touch orig/file && rsync -ai --backup-dir=orig~ orig backup
created directory backup
cd+++++++++ orig/
>f+++++++++ orig/file

$ tree
├── backup
│   └── orig
│       └── file
└── orig
    └── file

$ touch orig/file && rsync -ai --backup-dir=orig~ orig backup
>f..t...... orig/file

$ tree
├── backup
│   ├── orig
│   │   └── file
│   └── orig~
│       └── orig
│           └── file
└── orig
    └── file

In summary, what is the difference between the following commands?

Code:
rsync -ai --backup --backup-dir=orig~ orig backup
rsync -ai --backup-dir=orig~ orig backup

they seem to do the same thing
 

Members online


Top