Last active
August 31, 2019 05:51
-
-
Save kosztik/e8cfe9015e01466d945d6eadb5458220 to your computer and use it in GitHub Desktop.
rename accent files and dirs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PATH="/home/ebfijjk/anks" | |
# Put the old filenames in a file. | |
ls $PATH >> oldValues | |
# Put the new names without accents in another file | |
cat oldValues | sed -e 'y/āáǎàēéěèīíǐìōóǒòūúǔùǖǘǚǜĀÁǍÀĒÉĚÈĪÍǏÌŌÓǑÒŪÚǓÙǕǗǙǛ/aaaaeeeeiiiioooouuuuüüüüAAAAEEEEIIIIOOOOUUUUÜÜÜÜ/' >> newValues | |
# Create a new file with Old names and New names seperated by a #. | |
paste -d'#' oldValues newValues >> oldAndNew | |
# Read the file with both old and new names and rename them with the new names. | |
while IFS='#'; read oldValue newValue | |
do | |
mv "$oldValue" "$newValue" | |
done < oldAndNew | |
rm oldValues newValues oldandNew |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment