You could use diff
with process substitution:
diff <(ls -a dir1/) <(ls -a dir2/)
<(...)
creates a file descriptor whose path is added as argument todiff
.- When no sort option is given,
ls
sort the output alphabetically. - The two
ls
-outputs are give todiff
for comparsion.
My example folders look like this:
. ├── dir1 │ ├── file1 │ ├── file2 │ └── file3 └── dir2 ├── file2 ├── file3 └── file4
The output is this case is:
$ diff <(ls -a dir1/) <(ls -a dir2/) 3d2 < file1 5a5 > file4