11#! /bin/bash
22
3- BASE_DIR=" ."
3+ # Accept source and destination directories as arguments
4+ SOURCE_DIR=" ${1:- .} "
5+ DEST_DIR=" ${2:- ./ processed} "
6+
47echo " Starting script in folder: $( pwd) "
8+ echo " Source directory: $SOURCE_DIR "
9+ echo " Destination directory: $DEST_DIR "
10+
11+ # Copy source to destination
12+ cp -r " $SOURCE_DIR " /* " $DEST_DIR /"
13+ echo " Copied files from $SOURCE_DIR to $DEST_DIR "
14+
15+ # Work in the destination directory
16+ BASE_DIR=" $DEST_DIR "
517
618FILES=(
719bold.b7f0698.svg copy.95010ef.svg forward.7d44a5b.svg location-pin-solid.5b99343.svg pop-out.0a8fde3.svg share-screen-solid.c7c1310.svg user-profile-solid.e886eb1.svg
@@ -15,18 +27,34 @@ close.5ef7caf.svg favourite-solid.a1d4606.svg leave.8b03b57.svg play-solid.05663
1527collapse.fc765b9.svg files.453e84c.svg link.d0734d2.svg plus.95ca4d1.svg settings-solid.94c318a.svg user-add-solid.6a5ddef.svg
1628)
1729
30+ # Track unique folders that contain icon references
31+ declare -A FOLDERS_FOUND
32+
1833for filename in " ${FILES[@]} " ; do
1934 # Escape regex special chars for sed
2035 ESCAPED_FILENAME=$( printf ' %s' " $filename " | sed ' s/[.[\*^$/]/\\&/g' )
2136
2237 # Find all files containing this reference
2338 grep -rl " /icons/$filename " " $BASE_DIR " | while read -r file; do
24- echo " Processing folder: $( dirname " $file " ) "
39+ folder=$( dirname " $file " )
40+ FOLDERS_FOUND[" $folder " ]=1
41+ echo " Found reference in: $file "
2542 sed -i " s|/icons/$ESCAPED_FILENAME |/ui-icons/$filename |g" " $file "
2643 echo " Updated: $file "
2744 done
2845done
2946
47+ # Log summary of folders
48+ echo " "
49+ echo " === SUMMARY: Folders containing icon references ==="
50+ find " $BASE_DIR " -type f -exec grep -l " /icons/" {} \; | while read -r file; do
51+ dirname " $file "
52+ done | sort -u | while read -r folder; do
53+ echo " - $folder "
54+ done
55+ echo " === END SUMMARY ==="
56+ echo " "
57+
3058# --- Handle index.html separately ---
3159INDEX_FILE=" $BASE_DIR /index.html"
3260
0 commit comments