Check if all files in a directory exists elsewhere

Posted by aioobe on Server Fault See other posts from Server Fault or by aioobe
Published on 2012-06-10T07:06:33Z Indexed on 2012/06/10 10:41 UTC
Read the original article Hit count: 318

Filed under:
|
|

I'm about to remove an old backup directory, but before doing so I'd like to make sure that all these files exist in a newer directory.

Is there a tool for this? Or am I best off doing this "manually" using find, md5sum, sorting, comparing, etc?


Clarification:

If I have the following directory listings

/path/to/old_backup/dir1/fileA
/path/to/old_backup/dir1/fileB
/path/to/old_backup/dir2/fileC

and

/path/to/new_backup/dir1/fileA
/path/to/new_backup/dir2/fileB
/path/to/new_backup/dir2/fileD

then fileA and fileB exists in new_backup (fileA in its original directory, and fileB has moved from dir1 to dir2). fileC on the other hand is missing in new_backup and fileD has been created. In this situation I'd like the output to be something like

fileC exists in old_backup, but not in new_backup.

© Server Fault or respective owner

Related posts about file

Related posts about difference