I am using tree and diff to compare a local directory with a USB backup version of the same directory, and to identify noteworthy / discardable differences.
$ cd home/dir/ $ tree --charset=ascii -af . > ~/tree__local $ cd {usb}/home/dir/ $ tree --charset=ascii -af . > ~/tree__usb $ diff ~/tree__local ~/tree__usb > ~/diff-analysis.txt But I've noticed that tree has the habit of leaving out parent branches for last items … Ugh, this is hard to describe with words:
$ tree --charset=ascii -af . . |-- ./bar | |-- ./bar/babushka | |-- ./bar/galeda | `-- ./bar/helga `-- ./foo |-- ./foo/alpha |-- ./foo/beta `-- ./foo/gamma 8 directories, 0 files # add a new final item. $ touch zebra # same command. $ tree --charset=ascii -af . . |-- ./bar | |-- ./bar/babushka | |-- ./bar/galeda | `-- ./bar/helga |-- ./foo | |-- ./foo/alpha | |-- ./foo/beta | `-- ./foo/gamma `-- ./zebra 8 directories, 1 file Notice how the files in foo/ have gained an additional pipe branch. The diff command marks these as differences even though the files themselves are actually not different at all.
This is very suboptimal for my purposes. Do you guys happen to know how to circumvent or prevent that? Can you force homogenous pipe branches all the way down? The tree manual makes no mention of formatting the "last" or "final" item.
find .in each, or usersyncas noted in one of the answers. You're trying to hammer in a screw.