Skip to content

Instantly share code, notes, and snippets.

@nkuln
Created September 15, 2012 11:54
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 nkuln/3727483 to your computer and use it in GitHub Desktop.
Save nkuln/3727483 to your computer and use it in GitHub Desktop.
Simple batch file name replace in bash
!/bin/bash
# Debugging .. print all commands executed
set -x
for f in *
do
# Replace all occurrences of '%20' with ' ' (single space)
newname=${f//%20/ }
# We're safer with quotes around ..
mv "$f" "$newname"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment