Created
July 23, 2021 06:22
-
-
Save djego/06c5b262d678951594656389d8ca1a2d to your computer and use it in GitHub Desktop.
Remove files unused for example png files
This file contains 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 | |
## 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