Last active
August 29, 2015 14:06
-
-
Save sureshnath/d099982f0f06ba8ada60 to your computer and use it in GitHub Desktop.
unix remove files currently not active and find and remove files modified n days ago
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # remove files in the current directory, which are currently not in use | |
| for file in `ls -1`; do fuser $file; if [ $? != '0' ]; then rm -f $file; fi; done | |
| # remove files modified 3 days ago | |
| find -type d -mtime +3 -exec rm -rf {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment