I often face a problem, spend significant amounts of time finding the solution, apply the solution, and then forget it. And when I face the same problem later on, I remember I knew the solution once, but have long forgotten it by then. And I ask myself:
How the Hell did I do that?
Hence this blog. And for my first post, directory structure comparison. Handy for anyone who wants to keep data synced across external hard drives, or who wants to make sure that a big copy procedure went well. This is linux-based, it also works on Mac OS X, here goes:
- find /path1 -exec basename {} \; | sort > file1
- find /path2 -exec basename {} \; | sort > file2
- # at this point you can use diff file1 file2
- # or
- # here we want files only listed in file1 but not in file2
- comm -23 file1 file2
- # here we show files listed in file2 but not in file1
- comm -23 file2 file1
And the be-nice reference link to where I found it:
No comments:
Post a Comment