Last active
August 29, 2015 14:21
-
-
Save jamesrr39/8eca23bdecd54ab700ef to your computer and use it in GitHub Desktop.
Find unused resources
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 | |
# a script to find any javascripts that may not be used anywhere anymore. | |
base_directory="." | |
all_files=$(find "$base_directory" -type f) | |
for file in $all_files | |
do | |
import_name=$(echo "$file" | rev | cut -d "/" -f 1 | rev | sed -e 's/\.js$//') | |
if [ $(grep -R "$import_name" . | wc -l) -eq 0 ]; | |
then | |
echo "unused:$file"; | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment