Difference between revisions of "Linux command: rsync"
Jump to navigation
Jump to search
Rafahsolis (talk | contribs) |
Rafahsolis (talk | contribs) |
||
| Line 5: | Line 5: | ||
If rsync finds a file that has been changed, created, or deleted in Directory1, it will reflect those same changes to Directory2. | If rsync finds a file that has been changed, created, or deleted in Directory1, it will reflect those same changes to Directory2. | ||
| − | 1. -a = recurse into directories, links (copy symlinks as symlinks), perms (preserve permissions), times (preserve modification times), group (preserve group), owner (preserve owner), preserve device files, and preserve special files. | + | 1. -a = recurse into directories, links (copy symlinks as symlinks), perms (preserve permissions), times (preserve modification times), group (preserve group), owner (preserve owner), preserve device files, and preserve special files.<br /> |
| − | 2. -v = verbose. You can see exactly what rsync is backing up. backups. | + | 2. -v = verbose. You can see exactly what rsync is backing up. backups.<br /> |
| − | 3. –delete = This tells rsync to delete any files that are in Directory2 that aren’t in Directory1. | + | 3. –delete = This tells rsync to delete any files that are in Directory2 that aren’t in Directory1.<br /> |
Revision as of 11:16, 30 July 2015
Create backups
rsync -av --delete /Directory1/ /Directory2/
The code above will synchronize the contents of Directory1 to Directory2, and leave no differences between the two.
If rsync finds that Directory2 has a file that Directory1 does not, it will delete it.
If rsync finds a file that has been changed, created, or deleted in Directory1, it will reflect those same changes to Directory2.
1. -a = recurse into directories, links (copy symlinks as symlinks), perms (preserve permissions), times (preserve modification times), group (preserve group), owner (preserve owner), preserve device files, and preserve special files.
2. -v = verbose. You can see exactly what rsync is backing up. backups.
3. –delete = This tells rsync to delete any files that are in Directory2 that aren’t in Directory1.