-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrename-ai-docs.sh
More file actions
executable file
·51 lines (39 loc) · 1.35 KB
/
rename-ai-docs.sh
File metadata and controls
executable file
·51 lines (39 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Script to rename AI documentation files (claude.md, agent.md, gemini.md)
# Usage: ./rename-ai-docs.sh [claude|agent|gemini]
if [ $# -eq 0 ]; then
echo "Usage: $0 [claude|agent|gemini]"
echo "This will rename all claude.md, agent.md, and gemini.md files to the specified name"
exit 1
fi
TARGET="$1"
if [[ ! "$TARGET" =~ ^(claude|agent|gemini)$ ]]; then
echo "Error: Argument must be 'claude', 'agent', or 'gemini'"
exit 1
fi
TARGET_FILE="${TARGET}.md"
echo "Renaming all claude.md, agent.md, and gemini.md files to ${TARGET_FILE}..."
echo ""
# Counter for renamed files
count=0
# Find and rename all matching files
for file in $(find . -type f \( -name "claude.md" -o -name "agent.md" -o -name "gemini.md" \)); do
# Get the directory of the file
dir=$(dirname "$file")
current_name=$(basename "$file")
# Skip if already the target name
if [ "$current_name" == "$TARGET_FILE" ]; then
continue
fi
# Check if target file already exists in the same directory
if [ -f "${dir}/${TARGET_FILE}" ]; then
echo "⚠️ Skipping ${file} - ${dir}/${TARGET_FILE} already exists"
continue
fi
# Rename the file
mv "$file" "${dir}/${TARGET_FILE}"
echo "✓ Renamed: ${file} → ${dir}/${TARGET_FILE}"
((count++))
done
echo ""
echo "Done! Renamed ${count} file(s) to ${TARGET_FILE}"