Skip to content

Instantly share code, notes, and snippets.

@demdxx
Created April 23, 2014 06:55
Show Gist options
  • Save demdxx/11205049 to your computer and use it in GitHub Desktop.
Save demdxx/11205049 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
if [ "$#" -ne 3 ]; then
echo "use: gmv <source_dir> <file_name> <new_file_name>" >&2
exit 1
fi
seqname=`echo 's/\/'$2'$/'$3'/'`
find $1 -type f -name $2 | while read fn; do mv -v "${fn}" "`echo "${fn}" | sed -e "$seqname"`"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment