chore: add hypen to underscrore script for filenames
This commit is contained in:
parent
b89473701a
commit
1b97f04f73
1 changed files with 20 additions and 0 deletions
20
scripts/hyphen_to_underscore.sh
Executable file
20
scripts/hyphen_to_underscore.sh
Executable 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
|
Loading…
Add table
Reference in a new issue