Check that 2 directories are the same | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Check that 2 directories are the same

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 08-26-2005
mmarino mmarino is offline
Registered User
 
Join Date: Aug 2005
Last Activity: 7 August 2006, 2:50 PM EDT
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Question Check that 2 directories are the same

I need to make a copy of a directory keeping ownership, dates and links for all files intact. For that I'm using tar. Then I have to verify that the new directory and the old one are exactly the same (requirement is that the sums of all files are the same). The directory has many subdirectories and directories within directories, so just doing a sum of an ls command is not working...
Can someone point me in the right direction?

Thanks! :
Sponsored Links
    #2  
Old 08-26-2005
vertigo23's Avatar
vertigo23 vertigo23 is offline
Registered User
 
Join Date: Jul 2005
Last Activity: 22 April 2011, 6:50 PM EDT
Location: SF, CA
Posts: 74
Thanks: 1
Thanked 0 Times in 0 Posts
here's one way:

Code:
/you/are/in/original-dir$ md5sum `find . -type f` > /tmp/original.md5s
/path/to/copy/of/original-dir$ md5sum `find . -type f` > /tmp/new.md5s
/tmp$ diff ./original.md5s ./new.md5s

Hope this helps!
Sponsored Links
    #3  
Old 08-26-2005
mmarino mmarino is offline
Registered User
 
Join Date: Aug 2005
Last Activity: 7 August 2006, 2:50 PM EDT
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks! That's what I needed
    #4  
Old 08-26-2005
dangral dangral is offline Forum Advisor  
Registered User
 
Join Date: Oct 2002
Last Activity: 31 July 2013, 6:52 PM EDT
Posts: 723
Thanks: 3
Thanked 4 Times in 4 Posts
I've said it so many times, rsync is an excellent syncing program.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to check existance of multiple directories lookinginfo Shell Programming and Scripting 1 09-14-2011 12:18 PM
delete and check directories sbavanis Shell Programming and Scripting 1 06-11-2010 04:17 AM
check if multiple directories exist else create missing directories ramky79 Shell Programming and Scripting 7 08-19-2009 02:23 PM
Check all files in directories for string and remove.. possible? LordJezo Shell Programming and Scripting 7 11-30-2005 12:00 AM
What/How to check before deleting files and directories yvochan UNIX for Dummies Questions & Answers 4 07-29-2005 09:42 PM



All times are GMT -4. The time now is 03:59 PM.