LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Command to compare drives and copy missing files (https://www.linuxquestions.org/questions/linux-general-1/command-to-compare-drives-and-copy-missing-files-4175478041/)

Subito Piano 09-21-2013 07:49 PM

Command to compare drives and copy missing files
 
Hi! I migrated my OS and home directory (on separate partitions) to a new laptop with a new HD. Copying my home folder was MOSTLY successful. After discovering some missing directories I had to hook up my old drive via a USB adapter and manually compare my original /home folder with my new one to find any obvious missing files, but I just can't go through all the subdirectories with a fine-tooth comb to look for more, since it's over 100GB and has years of files.

So -- I need a command to compare my old drive (my old /home folder) with my new one, and automatically copy any missing files into the correct subdirectories in my new drive. Using drag-and-copy through the usual file managers just doesn't seem to cut it, as I can't seem to tell it to "skip" overwriting existing files and then remember the answer -- it keeps asking me EVERY time for EACH file -- !!!!

Thanks for your help!

(Lubuntu 12.04 on a Lenovo S205)

sag47 09-21-2013 07:56 PM

rsync is what you want. (apt-get install rsync)

Code:

rsync -av /src/ /dst/
The trailing slashes will compare the contents of each of those directories to each other and copy only missing files from src to dst (source and destination).

Subito Piano 09-21-2013 11:19 PM

Thank you! http://mysterdee.com/smilies/snoozer_likelinux_man.gif


All times are GMT -5. The time now is 08:15 AM.