As simple as one single command :
find -type d -empty -delete
As simple as one single command :
find -type d -empty -delete
The find utility on linux allows you to pass in a bunch of interesting arguments, including one to execute another command on each file. We’ll use this in order to figure out what files are older than a certain number of days, and then use the rm command to delete them.
Command Syntax
find /path/to/files* -mtime +5 -exec rm {} \;
Note that there are spaces between rm, {}, and \;
Explanation
or you can use the following command :
find /path/to/files* -mtime +5 | xargs rm -f
This should work on Ubuntu, Suse, Redhat, or pretty much any version of linux.
Powered by WordPress