Logo 
Search:

Unix / Linux / Ubuntu Forum

Ask Question   UnAnswered
Home » Forum » Unix / Linux / Ubuntu       RSS Feeds

Comparing folders and files

  Date: Dec 04    Category: Unix / Linux / Ubuntu    Views: 501
  

I have got a folder on my external hard drive and another folder on my pc hard
drive. Both are essentially the same folders, but the folder on my pc is an
updated one. I was wondering that is there any software which can tell me what
files are missing on the folders in my external hard drive?

This is because the folder is too big and I dont want to make copies of the
folder.

I would be really grateful if you can help me out on that.

Thank you for your considerations and hope to hear from you soon.

Share: 

 

5 Answers Found

 
Answer #1    Answered On: Dec 04    

I forgot to add
~$ diff folder1 folder2

will do the exact same thing, just you don't have the options you get with
ls such as listing extra details to tell which file in a folder is most
recent (at least not that I know how to do).

also , I see there is something called "rsync" which is supposed to
automatically copy over files that do not exist in the target folder. see
this website for details:
unstableme.blogspot.com/.../...s-using-diff-bash.h\
tml

 
Answer #2    Answered On: Dec 04    

You can do this from the command prompt if you want, though maybe there is
some software too?

From the terminal:
~$ ls /path/to/desktop/folder > file_home
~$ ls /path/to/external/hd/folder > file_external
~$ ls diff file_home file_external

the above will create two text files (file_home, file_external) in the first
two steps. the third steps compare them and gives an output as to what is
different between the two. a "<" or ">" will indicate whether it was the
left (file_home) or right (file_external) that had the extra file. You can
play around with two dummie directories on your desktop with text files in
them to get the hang of it.

note: file_home and file_external will be created in the directory you are
currently in. you can leave them for next time, or delete them or whatever
you prefer. They will just be overwritten each time you do the above... oh,
and you can just name them 1 and 2 if you want.

 
Answer #3    Answered On: Dec 04    

There probably is, and an Internet search should reveal it. A simple but
slow way is to copy the smaller parent folder onto the larger, telling it to
autoskip duplicates when they occur. Then you should wind up with the same
number of files and folders in each. If not, because there are some files
and/or folders that are still not common to both, just copy the other
direction. Barring a bad copy operation (very rare) you then have what you
wanted.

 
Answer #4    Answered On: Dec 04    

'rsync' will do the job you want and can sync either way.

 
Answer #5    Answered On: Dec 04    

I tried rsync, but then I found another software called "Meld Diff viewer". It
is all gui based and very easy to use. Hope you guys will find it useful. This
software is commercially available as well.

 
Didn't find what you were looking for? Find more on Comparing folders and files Or get search suggestion and latest updates.




Tagged: