Skip to content

Instantly share code, notes, and snippets.

@janbaer
Created January 25, 2019 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janbaer/4a37e97a163f77ab765303643e84751b to your computer and use it in GitHub Desktop.
Save janbaer/4a37e97a163f77ab765303643e84751b to your computer and use it in GitHub Desktop.
Rename files that are located in the current directory
for FILE in *.mp4; do
mv "$FILE" "`echo $FILE | sed -r "s/^(.+)_hd-froscon16.+.mp4$/\1.mp4"/`";
done
@janbaer
Copy link
Author

janbaer commented Feb 2, 2019

This one is much easier to write and also to understand I think ;-)

rename -v 's/^\d+-(.+).pdf/$1.pdf/' *.pdf

@janbaer
Copy link
Author

janbaer commented Feb 2, 2019

Also take a look on mmv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment