Last active
December 20, 2018 12:08
-
-
Save sprytnyk/c160e2021ac0a0e033bbed42710ae8cd to your computer and use it in GitHub Desktop.
A simple clean up helper of *.swp and *.pyc files.
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 | |
echo "### Cleaning *.pyc, *.swp and *.DS_Store files." | |
# Get a path from the first argument. | |
if [[ $* ]]; then | |
LOCATION=$* | |
else | |
LOCATION=$(pwd) | |
fi | |
# Go to the provided path and perform clean up of junk files. | |
cd "${LOCATION}" || exit | |
find . -name '*.pyc' -print0 | xargs -0 rm > /dev/null 2>&1 | |
find . -name '*.swp' -print0 | xargs -0 rm > /dev/null 2>&1 | |
find . -name '*.DS_Store' -print0 | xargs -0 rm > /dev/null 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment