0

Folder 1(210GB) contains the contents from Folder 2(198GB) plus some extra files.

All files are music.

Looking for a way to find out what is in Folder 1 that isn't in Folder 2.

Hope that makes sense.

2 Answers 2

3

There is a fleet of software that does this, for example beyond compare. It is not a free Software, but it has a free trial and for doing it once it should be fine.

You can also use diff in the terminal to search for those files like this:

diff --brief -r dir1/ dir2/

This will give you an output similar to this one:

Only in dir1/dir11/dir111: file4
Only in dir2/: file2
Only in dir1/: file3

You can then use cut and sed to get the missing files and their paths:

| cut -c 9- | sed 's/\/: /\//g' | sed 's/: /\//g'

And then you can use xargs and cp to copy the files like this:

xargs -I{} cp "{}" dir3

So the whole line would be

diff --brief -r dir1/ dir2/ | \
    cut -c 9- | sed 's/\/: /\//g' | sed 's/: /\//g' | \
    xargs -I{} cp "{}" dir3

Just make sure to replace dir1 and dir2 with directories that you want to search and dir3 with the output directory.

If you want to keep the folder structure for the copied files use ditto instead of cp like this:

diff --brief -r dir1/ dir2/ | \
    cut -c 9- | sed 's/\/: /\//g' | sed 's/: /\//g' | \
    xargs -I{} ditto "{}" dir3
4
  • 1
    What exactly does --brief and -r do?
    – Lano
    Jun 24, 2021 at 7:49
  • -r means recursive, so it also looks into subdirectories. And --brief reports only when files differ
    – Ant
    Jun 24, 2021 at 7:52
  • Thanks for the helpful answer. Unfortunately, the last code didn't work for me. I get the error message: cp: illegal option - -
    – Lano
    Jun 24, 2021 at 7:54
  • Yes, you are right, I fixed it. Sorry for the confusion.
    – Ant
    Jun 24, 2021 at 7:58
-2

There are multiple apps available on Appstore to find the duplicate files on Mac. Best one I would suggest is Duplicate File Finder Remover.

2
  • 2
    Does Duplicate File Finder Remover find files that are not duplicates?
    – Scottmeup
    Jun 24, 2021 at 5:45
  • This app would highlight the duplicates and allow us to select and remove. This helps in cleaning. Jun 24, 2021 at 8:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .