Sunday 15 July 2012

Linux : how to delete files from a certain month or year
To delete from a certain month (Linux never shows the year for files from this year) :
ls -la | grep May | /usr/bin/tr -s ' ' | /usr/bin/cut -d ' ' -f9 | xargs rm

To delete files from a certain year :
ls -la | grep 2010 | /usr/bin/tr -s ' ' | /usr/bin/cut -d ' ' -f9 | xargs rm 

No comments:

Post a Comment

Note: only a member of this blog may post a comment.