Pages

Wednesday, November 12, 2008

Ubuntu Tricks: Empty Directories

Have you ever used a tool that would go through subdirectories and delete the empty ones? One Windows I was able to do this with Heatsoft Clone Cleaner Pro (trial). But really, there has to be an easier way to do this without adding more software glut.

For those who like to manage their files, I do as part of work, here's a tip. If you can mount/map your main subdirectory onto Linux, all you have to do is issue this shell command:

find /path/you/specify -type d -empty -delete

It doesn't get any simpler than that. I did find however that in some instances when mixing symbolic links that it won't take. So you can try to change the target to a deeper directory level and issue the command from there. You can also go to the directory itself whereupon the simple format is to do: find ./ -type d -empty -delete

Simple and done. Happy!

No comments:

Post a Comment