Scenario:
- 2 main folders, that may have subfolders with the same names (I do not know what names might be duplicated, that's what I am trying to find)
- the subfolders have MANY other files & subfolders so tools with automatic recursion are not really an option
- I only care about duplicate subfolder names on the first level of the two main folders
- contents of the subfolders don't matter
- contents of the files don't matter
I tried using meld
GUI but that just takes endless time to finish for these structures.
I tried using diff --brief --report-identical-files folder1 folder2
but that basically reports everything and it does not even include the folders so I can't even | grep identical
.
Am I using wrong tools? Or is there some trick that I didn't get from diff --help
? Or am I doing something wrong?
Thanks
I'd use a simple
find
:Or to make it zero-terminated to prevent issues with newline characters:
Using
zsh
, giventhen
creates arrays of the tails (basenames) of directories
/
in the two top-level directoriesdir1
anddir2
(with Dotglob and Nullglob options enabled).Then we can use an expansion of the form
${name:*arrayname}
to retain only elements that are present in both arrays: