Robot Butler
  Making those complicated tasks nice and easy.
  A hub for guides, walkthroughs and general information.
Follow us on Twitter RSS Feed
There are many ways of manipulating files and folders in Linux through the use of Perl, Python, AWK, Bash script and other programs but Find is slowly expanding to make certain tasks easier.

Removing empty folders now needs only a single line made up of few words. Using a terminal simply navigate to the top level directory that you'd like to scan for empty folders and run the following command:

find -type d -empty -delete

And that's it. Find will now scan through and remove any empty folders. This should only take a second or two but may take a little longer if you have masses of content.

Comments

Auto-Avatar
James Sanders   ~   Posted on 2011-10-04 16:12:53
Obviously doing the same command above with the "-type f" instead will remove all empty files in the current directory and all sub directories.

Post a Comment

    Name
    Email (not displayed)

The name of this website is Robot...      


Info STATISTICS

  • 14 categories
  • 50 articles
  • 137 comments

Site, design and code by Benjamin Hodgetts.