# Help with CLI commands



## FreeDomBSD (Oct 24, 2013)

I have a few TBs of data that I copied from one drive (source folder) onto another (destination folder). Unfortunately not all of the data copied successfully, but 90% of it did. I would like to run a set of commands with which I can compare the source and the destination folder and then copy/recopy the files that do not match the files in the source folder.

I'd appreciate a nudge in the right direction.


----------



## kpa (Oct 24, 2013)

net/rsync has support for comparing the source and destination files/directories and copying only the changed files or the ones missing from the destination.


----------



## FreeDomBSD (Oct 24, 2013)

`rsync -v /home/user/a /home/user/b`


Does this look right for what I'm doing?

Or is it:

`rsync -v -r /home/user/a /home/user/b`


----------



## DutchDaemon (Oct 24, 2013)

`rsync -av` does it right. If you're on a slow WAN, add a -z.


----------



## FreeDomBSD (Oct 24, 2013)

Thanks DutchDaemon! I'm not on a LAN or WAN. I'm just copying between two external USB drives that are mounted.


----------



## kpa (Oct 24, 2013)

Make sure you understand the difference between `rsync -av /home/user/a /home/user/b` and `rsync -av /home/user/a/ /home/user/b`. The first form would create an extra directory /home/user/b/a that you probably don't want.


----------



## FreeDomBSD (Oct 24, 2013)

Yea, crap, found that out the hard way @kpa. What is the point of the -a and why not use the the -r switch?


----------



## kpa (Oct 24, 2013)

The -a flag is a shortcut for flags -rlptgoD, see the manual page for details rsync(1).


----------



## FreeDomBSD (Oct 24, 2013)

I've read another explanation that just mentioned that  -a was archival flag. It have no other explanation. Thanks for the link!


----------

