Skip to content

Instantly share code, notes, and snippets.

@devynspencer
Created September 20, 2015 08:44
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 devynspencer/233d241bbab4d4538827 to your computer and use it in GitHub Desktop.
Save devynspencer/233d241bbab4d4538827 to your computer and use it in GitHub Desktop.
Example highlighting the use of a for loop to rename all file beginning with 720 and not ending with .mp4
for i in $(ls 720^*.mp4); do
mv $i{,.mp4}
done
@devynspencer
Copy link
Author

An alternative using find:

find . -iname "*720*" -depth 1 -exec mv {}{,.mp4} \;

Note: this doesn't exclude files ending with '.mp4' as above

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