Skip to content

Instantly share code, notes, and snippets.

@KhasMek
Created May 31, 2012 18:54
Show Gist options
  • Save KhasMek/2845401 to your computer and use it in GitHub Desktop.
Save KhasMek/2845401 to your computer and use it in GitHub Desktop.
find and remove all occurrences of a file easily... I'm so lazy.
#!/bin/bash
name=${1}
location=${2}
if [ ! "$location" ]; then
location=.
fi
find $location -name $name | while read line
do
rm -rf "$line"
done
echo "all occurances of $name in $location deleted"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment