Re: how to copy files
On Mon, May 15, 2017 at 04:57:35AM +0800, Long Wind wrote:
> I have a folder in hard drive and a backup of it is made in a USB disk
> Now some new files are added to the folder in hard drive
> how to make the folder in USB disk the same as in hard drive?
> I want a program that can check the two folders
> if file size and file name are same, they are regarded as same
> if not, update is needed
> I have try rsync, but can't find such options
That's the default for rsync.
rsync /path/to/originals/ /path/to/copies/
add -r for recursion into subdirectories
add -v for verbosity
add -a (archive) to keep ownership, groups, and permissions
identical. That usually needs root privileges.
There are a lot of other options to rsync; you can have
unrecognized files in the destination ignored or deleted.
You can require the contents of all files to match, rather than
just their name and size.
You can have special exclusions and inclusions.
If you need changes on both directories to be reflected in each
other, you want unison instead of rsync.