Skip to content

Commit 3dd71dd

Browse files
committed
Merge pull request #2 from yomajkel/master
I'd like to have your change :)
2 parents 1dcea42 + 41c16d7 commit 3dd71dd

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

find-unused-resources.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,29 @@
44
echo "<html>"
55
echo "<h2> Unused resources </h2>"
66
#usual disclaimer
7-
echo "<i> <b>Note:</b> This scans all the xib, nib files for the images available. Please look for splash screens or other images carefully in the below list which are used in the project definition (pbxproj file)</i> <br>"
7+
echo "<i> <b>Note:</b> This scans all the xib, nib files for the images available. Please look for splash screens or other images carefully in the below list which are used in the project definition (pbxproj file).<br>In order for links to work the report file must be in the same folder as project.</i>"
88
unusedfiles="";
99
#initialize the counter
1010
let count=0;
11+
let totalsize=0;
1112
# collect the files needs to be introspected
1213
project=`find $1 -name '*.?ib' -o -name '*.[mh]'`
1314

1415
for i in `find $1 -name "*.png" -o -name "*.jpg"`; do
1516
file=`basename -s .jpg "$i" | xargs basename -s .png | xargs basename -s @2x`
1617
if ! grep -q $file $project; then
17-
unusedfiles="$unusedfiles <br> $i";
18-
# echo $i
19-
let "count = count + 1";
18+
filesize=`stat -f "%z" $i`;
19+
filesizekb=`echo "$filesize 1024.0" | awk '{printf "%.2f", $1 / $2}'`
20+
unusedfiles="$unusedfiles <br> <a href=\"$i\">$i</a> ($filesizekb kb)";
21+
let "count += 1";
22+
let "totalsize += $filesize"
2023
fi
2124
done
2225
#construct body
26+
totalsizekb=`echo "$totalsize 1024.0" | awk '{printf "%.2f", $1 / $2}'`
2327
echo "<body>"
2428
echo "<h3>"
25-
echo "There are $count unused images"
29+
echo "There are $count unused images (total size: $totalsizekb kb)"
2630
echo "</h3>"
2731
echo "<pre>"
2832
#generate body content if there are unused files.
@@ -57,4 +61,4 @@ fi
5761
echo "</pre>"
5862
echo "</body>"
5963
echo "</html>"
60-
#thats it!
64+
#thats it!

0 commit comments

Comments
 (0)