chore: add hypen to underscrore script for filenames

This commit is contained in:
thomasabishop 2024-02-17 12:17:25 +00:00
parent b89473701a
commit 1b97f04f73

20
scripts/hyphen_to_underscore.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
# Convert hypens in file names to underscores
main() {
find . -depth -name '*-*' | while read fname; do
new_fname=$(echo $fname | tr "-" "_")
if [ -e $new_fname ]; then
echo "File $new_fname already exists. Not replacing $fname"
else
echo "Creating new file $new_fname to replace $fname"
mv "$fname" $new_fname
fi
done
}
# Run and pipe errors and feedback to logfile
&>/dev/null
main