Skip to content

Instantly share code, notes, and snippets.



Last active Aug 31, 2019
What would you like to do?
rename accent files and dirs
# 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
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