Skip to content

Instantly share code, notes, and snippets.

@sharpmachine
Created August 26, 2016 19:30
Show Gist options
  • Save sharpmachine/367a6aec50409c7db056bea611a1cc00 to your computer and use it in GitHub Desktop.
Save sharpmachine/367a6aec50409c7db056bea611a1cc00 to your computer and use it in GitHub Desktop.
Batch rename commands
rename directories
for file in $(git ls-files | grep nsg- | sed -e 's/\(nsg-[^/]*\).*/\1/' | uniq); git mv $file $(echo $file | sed -e 's/nsg-//') -vn
rename files
for file in $(git ls-files | grep nsg- | uniq); git mv $file $(echo $file | sed -e 's/nsg-//') -vn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment