Copy Files As Perfect Backups in Another Directory
cp -a
You might be thinking right now that cp would be useful for backing up files, and that is certainly true. With a few lines in a bash shell script, however, cp can be an effective way to back up various files and directories. The most useful option in this case would be the -a option (or --archive), which is also equivalent to combining several options: -dpR (or --no-dereference --preserve --recursive). Another way of thinking about it is that -a ensures that cp doesn't follow symbolic links (which could grossly balloon your copy), preserves key file attributes such as owner and timestamp, and recursively follows subdirectories.
source: scott grannemann
No comments:
Post a Comment