Created
April 12, 2011 19:00
-
-
Save myusuf3/916148 to your computer and use it in GitHub Desktop.
bashfu - shift command
This file contains 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
#!/bin/bash | |
# This script can clean up files that were last accessed over 365 days ago. | |
USAGE="Usage: $0 dir1 dir2 dir3 ... dirN" | |
if [ "$#" == "0" ]; then | |
echo "$USAGE" | |
exit 1 | |
fi | |
while (( "$#" )); do | |
if [[ $(ls "$1") == "" ]]; then | |
echo "Empty directory, nothing to be done." | |
else | |
find "$1" -type f -a -atime +365 -exec rm -i {} \; | |
fi | |
shift | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment