Skip to content

Instantly share code, notes, and snippets.

@djego
Created July 23, 2021 06:22
Show Gist options
  • Save djego/06c5b262d678951594656389d8ca1a2d to your computer and use it in GitHub Desktop.
Save djego/06c5b262d678951594656389d8ca1a2d to your computer and use it in GitHub Desktop.
Remove files unused for example png files
#!/bin/bash
## Find files with extension ".png" and then search by filename into source code "src/" and if not exist result remove file
find src -name "*.png" > tmp
echo "Result files unused:"
while read p; do
b=$(basename $p)
if ! grep -rq $b src/; then
echo $p;
rm $p;
fi
done < tmp
rm tmp
echo "Files unused has been deleted!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment