LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-21-2013, 07:49 PM   #1
Subito Piano
LQ Newbie
 
Registered: Nov 2007
Location: UPSTATE New York
Distribution: Puppy; A/V Linux for playing live synth
Posts: 23

Rep: Reputation: 0
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)
 
Old 09-21-2013, 07:56 PM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
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).
 
1 members found this post helpful.
Old 09-21-2013, 11:19 PM   #3
Subito Piano
LQ Newbie
 
Registered: Nov 2007
Location: UPSTATE New York
Distribution: Puppy; A/V Linux for playing live synth
Posts: 23

Original Poster
Rep: Reputation: 0
Thank you!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Script to compare files in directories and if matches copy into third directory srinietrx Linux - Newbie 11 05-07-2013 11:45 PM
[SOLVED] How to compare a list of files in two directories: compare content and print size Batistuta_g_2000 Linux - Newbie 9 03-24-2013 07:05 AM
[SOLVED] Will (K)Ubuntu be able to read/copy/alter files on NTFS drives? mak2653 Linux - Newbie 2 04-07-2010 01:57 PM
in copy files or ls files the command want to invert select some files how to?? hocheetiong Linux - Newbie 3 06-27-2008 06:32 AM
Copy Files Between Drives Causes Kernel Panic/Freeze of the System php Slackware 7 08-14-2003 07:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration