-
-
Save lavoiesl/2836192 to your computer and use it in GitHub Desktop.
Remove temporary and junk files from Windows and OS X
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
#!/bin/bash | |
# | |
# Script to remove temporary and junk files 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) | |
# Mac | |
files[1]='.DS_Store' | |
files[2]='._*' # Temporary files | |
# Windows | |
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' | |
# Editors backup | |
files[10]='*~' | |
files[11]='*.swp' | |
# 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]="`pwd`" | |
#startpts[2]='/mnt/Videos' | |
#startpts[3]='/mnt/Music' | |
#### Start processing #### | |
echo Removing ${files[@]} from ${startpts[@]} | |
echo "" | |
# Combine all filenames in a series of -o -name | |
options="-name $(echo ${files[@]} | sed 's/ / -o -name /g')" | |
find ${startpts[@]} $options -print -delete | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment