Skip to content

Instantly share code, notes, and snippets.

@tonussi
Last active December 24, 2015 01:59
Show Gist options
  • Save tonussi/6727161 to your computer and use it in GitHub Desktop.
Save tonussi/6727161 to your computer and use it in GitHub Desktop.
rename.sh
#!/bin/sh
echo "Write the string extention ( ie .bash )\n"
echo "The program will accept multiple extention. ( ie .html.markdown )\n"
read oldext # = ".html.markdown"
echo "Write the new extention ( ie .sh )"
read newext # = ".md"
for file in *$oldext
do
echo file
cp ${file} ${file%$oldext}$newext
done
done
# Ele faz para arquivos escritos na forma [a-z]*U[0-9]*.[a-z]*U[0-9]*
# Mas para caracteres especiais está travando
# Por exemplo arquivos chamados:
# a.b
# a (3rd copy).b
# a (4th copy).b
# a (5th copy).b
# a (another copy).b
# a (copy).b
# Ele não trabalha.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment