Add test_rename.sh
This commit is contained in:
parent
a5422c2b3f
commit
d15ecb3956
1 changed files with 47 additions and 0 deletions
47
test_rename.sh
Normal file
47
test_rename.sh
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Create test directory
|
||||||
|
TEST_DIR="test_dir"
|
||||||
|
rm -rf "$TEST_DIR"
|
||||||
|
mkdir -p "$TEST_DIR"
|
||||||
|
cd "$TEST_DIR"
|
||||||
|
|
||||||
|
# Create test files with edge cases
|
||||||
|
touch "Test File (1).txt"
|
||||||
|
touch "Test File (2).txt"
|
||||||
|
touch "60% of Americans Don’t Have $1000 to Pay For Unexpected Medical Expenses.en.vtt"
|
||||||
|
touch "Are You The Patsy?.en.vtt"
|
||||||
|
touch "Can You Change The Culture of Healthcare At your Company?.en.vtt"
|
||||||
|
touch "Let’s Play A Game!.en.vtt"
|
||||||
|
touch "Spend More Time Researching Your Healthcare Budget!.en.vtt"
|
||||||
|
touch "401(k) Plan.en.vtt"
|
||||||
|
touch "Duplicate Name"
|
||||||
|
touch "Duplicate Name"
|
||||||
|
touch "Hidden File"
|
||||||
|
mv "Hidden File" ".Hidden File" # Make it a hidden file
|
||||||
|
|
||||||
|
# Create a long filename that is under the system limit (255 chars max)
|
||||||
|
long_base="VeryLongFilename_$(printf 'A%.0s' {1..234})"
|
||||||
|
touch "$long_base.txt"
|
||||||
|
|
||||||
|
# Print original files
|
||||||
|
echo "🔍 Original files:"
|
||||||
|
ls -1
|
||||||
|
|
||||||
|
# Dry run test
|
||||||
|
echo -e "\n🧪 Dry run (--dry-run):"
|
||||||
|
../rename_safe.sh --dry-run .
|
||||||
|
|
||||||
|
# Actual run test
|
||||||
|
echo -e "\n🚀 Actual run:"
|
||||||
|
../rename_safe.sh .
|
||||||
|
|
||||||
|
# Final listing
|
||||||
|
echo -e "\n✅ Final files after renaming:"
|
||||||
|
ls -1
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
cd ..
|
||||||
|
rm -rf "$TEST_DIR"
|
Loading…
Add table
Add a link
Reference in a new issue