Skip to content

Instantly share code, notes, and snippets.

@ivan-loh
Created December 12, 2016 20:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan-loh/88c77f32c3403bd5da8fd9ff62b36841 to your computer and use it in GitHub Desktop.
Save ivan-loh/88c77f32c3403bd5da8fd9ff62b36841 to your computer and use it in GitHub Desktop.
bash script to mass rename files in a directory
#!/bin/sh
SRCEXT="html"
DSTEXT="txt"
for file in *.$SRCEXT; do
echo "$file -> `basename "$file" .$SRCEXT`.$DSTEXT"
mv "$file" "`basename "$file" .$SRCEXT`.$DSTEXT"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment