While not really a shell script as such, this is shell related and it just so happens to be Sunday.
Find Empty Directories:
find . -type d -empty > empty_folders.txt
Find Empty Files
find . -type f -empty > empty_files.txt
The issue with these two commands is that within my jumble of unorganized mess I have an abundance of version control repositories (mostly SVN) and tons of source code with empty, but needed directories. Fear not if you have the same problem, you can filter them out by using:
grep -v empty_files.txt svn
Duplicate File Removal
There are multiple ways to remove duplicate files. I used to think a recursive md5sum script was the way to go but that was before I found the utility fdupes.
Install via your package manager if it’s available and use recursively like:
fdupes -r [directory] > duplicates.txt
With fdupes you also have the ability to symlink or delete files, although because of the amount of source code, I’d rather review it manually.
With these utilities I was able to merge copies of photos remove a bunch of old files and empty directories and am one step closer to being digitally organized. If you have the same problem, hopefully they will help you too. If you have any cleanup or organization tools, please comment and let me know.