Skip to content

Commit 3c92032

Browse files
committed
chore: adding script to check for duplicate files
1 parent fa250da commit 3c92032

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

scripts/check-for-ejs-duplicates.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
# Usage: ./scripts/check-for-ejs-duplicates.sh <directory>
4+
# Examples:
5+
# ./scripts/check-for-ejs-duplicates.sh frameworks/react-cra
6+
# ./scripts/check-for-ejs-duplicates.sh frameworks/solid
7+
8+
# Check if directory parameter is provided
9+
if [ -z "$1" ]; then
10+
echo "Usage: $0 <directory>"
11+
exit 1
12+
fi
13+
14+
# The directory to search in
15+
DIR="$1"
16+
17+
# Find all files that do NOT have .ejs extension
18+
find "$DIR" -type f ! -name "*.ejs" | while read -r file; do
19+
# Get the directory and filename
20+
file_dir=$(dirname "$file")
21+
file_name=$(basename "$file")
22+
23+
# Check if a .ejs version exists in the same directory
24+
ejs_file="${file_dir}/${file_name}.ejs"
25+
26+
if [ -f "$ejs_file" ]; then
27+
echo "Found matching pair: $file has corresponding $ejs_file"
28+
fi
29+
done

0 commit comments

Comments
 (0)