Created
May 30, 2012 00:43
-
-
Save anonymous/2831750 to your computer and use it in GitHub Desktop.
Remove Crap
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
# | |
# Script to remove junk from Windows and OS X | |
# | |
### Not set up to run as root. Advised not to do this. ### | |
#### Variables #### | |
# Files to remove (Add others, just remember to increment the | |
# index value between "[]" for each additional file) | |
files[1]='.DS_Store' | |
files[2]='._.DS_Store' | |
files[3]='Thumbs.db' | |
files[4]='thumbs.db' | |
files[5]='Desktop.ini' | |
files[6]='desktop.ini' | |
files[7]='ehthumbs_vista.db' | |
files[8]='SyncToy*.dat' | |
files[9]='ignore_my_docs' | |
# Folders to remove (Add others, just remember to increment | |
# the index value between "[]" for each additional file) | |
folders[1]='.Trash-1000' | |
folders[2]='.Trashes' | |
# Starting poings (paths) to look for files and folders (Add others, just | |
# remember to increment the index value between "[]" for | |
# each additional file) | |
startpts[1]="$HOME" | |
#startpts[2]='/mnt/Videos' | |
#startpts[3]='/mnt/Music' | |
#### Start processing #### | |
echo "" | |
echo "Starting crap removal..." | |
echo "" | |
# For each starting point (path) defined... | |
for startpt in "${startpts[@]}"; | |
do | |
echo "" | |
echo "Combing through $startpt and removing the following:" | |
# For each file specified... | |
for file in "${files[@]}"; | |
do | |
echo " - $file files..." | |
# Find the file and remove it. | |
find $startpt -name $file -delete | |
done | |
# For each folder specified.... | |
for folder in "${folders[@]}"; | |
do | |
echo " - $folder folders..." | |
# Find the folder and remove it. | |
find $startpt -name $folder -delete | |
done | |
echo "" | |
done | |
echo "" | |
echo "Done." | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment