Linux Blog

Cleaning Up Files & Directories

Filed under: Shell Script Sundays — at 8:30 am on Sunday, August 19, 2012

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.

File Cleanup Tools and Tactics

Filed under: General Linux,Linux Software,The Linux Blog News — at 10:35 pm on Wednesday, August 8, 2012

Ok, I’ll admit it; I’m a digital hoarder. I’ve had this problem for a while where I can’t seem to delete stuff. Perhaps its files I’ve created, stuff I’ve downloaded, backups, or backups of backups but files seem to accumulate faster than I can keep up with organizing them. Throw this on top of system re-installs and, being the family geek backups of family members and freelance work to be honest, I’m a bit overwhelmed!

Well, it stops today! At least the start of organization that is. I’ve written in the past about spring cleaning tools, recursive md5sum scripts and tools like md5deep but nothing really came of it. It’s time to take action and get stuff organized. Now I’ve admitted it publicly, I’m sort of obligated to get in control of my digital life and so the voyage begins.

Stay tuned for more posts on digital organization techniques and tools!