0

I have two folders, "old" and "new". The "new" folder includes files from "old" that have been copied into subfolders by a program.

[-] Test
 |--[-] New
 |   |--[-] 2
 |   |   `----- File2.txt
 |   |--[-] 3
 |   |   |----- File3.txt
 |   |   |----- File4.txt
 |   |   `----- File5.txt
 |   `----- File1.txt
 `--[-] Old
     |----- File1.txt
     |----- File2.txt
     |----- File3.txt
     `----- File4.txt

I want to compare the list of files (and, optionally and preferrably, their contents e.g. by checksum) between both "old" and "new" to confirm that all files from "old" exist somewhere in "new", regardless of their subdirectory location.

Any thoughts on how this can best be achieved in linux and/or emacs? I have found many tools (e.g. ztree, diff, meld, etc. but they seem to compare directory structures whereas I am only interested in file list/flattened/"branch view" style comparison.

1

1 Answer 1

0

You can produce a flattened file listing with checksums like so:

find DIR -type f -print \
  | xargs cksum \
  | sed 's/^\([0-9]\+ [0-9]\+ \)\(.*\/\)\(.\+\)/\1\3/' \
  | sort -k3

Then you can just diff the output for both DIR values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.