Skip to content

Instantly share code, notes, and snippets.

@BillFleming
Created December 1, 2019 23:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save BillFleming/9cf58245c5544896181ce99cb108edb5 to your computer and use it in GitHub Desktop.
Save BillFleming/9cf58245c5544896181ce99cb108edb5 to your computer and use it in GitHub Desktop.
Scripts to rename ".wmv" files in a game's subdirectories.
#!/bin/bash
# Rename ".wmv" files in all subdirectories to "_.wmv"
find . -name '*.wmv' -exec sh -c 'mv "$0" "${0%.wmv}_.wmv"' {} \; -exec echo {} \;
#!/bin/bash
# Rename ".wmv" files in all subdirectories to "_.wmv" then create 0 byte ".wmv" files in their place.
find . -name '*.wmv' -exec sh -c 'mv "$0" "${0%.wmv}_.wmv"' {} \; -exec echo {} \; -exec touch "0%" {} \;
#!/bin/bash
# Rename "_.wmv" files in all subdirectories back to ".wmv"
find . -name '*_.wmv' -exec echo {} \; -exec sh -c 'mv "$0" "${0//_/}"' {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment