Skip to content

Instantly share code, notes, and snippets.

@sprytnyk
Last active December 20, 2018 12:08
Show Gist options
  • Save sprytnyk/c160e2021ac0a0e033bbed42710ae8cd to your computer and use it in GitHub Desktop.
Save sprytnyk/c160e2021ac0a0e033bbed42710ae8cd to your computer and use it in GitHub Desktop.
A simple clean up helper of *.swp and *.pyc files.
#!/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