fogbound.net




Tue, 12 Nov 2024

Directory structure compare

— SjG @ 11:39 am

There’s gotta be a better way. But after a horrible upgrade process for a horrible commercial open-source product, I need to see which sub-directories from the old installation are missing in the new one. Don’t ask. I’ve literally been having nightmares about this upgrade.

Anyway, given tree1 and tree2 under some common point, I want a list of directories that exist in tree1 and don’t exist in tree2.

Here was my clumsy way of solving the problem.

cd tree1
find . -type d -print | sort > ../dirs_old
cd ../tree2
find . -type d -print | sort > ../dirs_new
cd ..
comm -23 dirs_old dirs_new


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.