Skip to content

Instantly share code, notes, and snippets.

@plembo
Created March 30, 2019 15:52
Show Gist options
  • Save plembo/cc8e037f3adddfa56d2d1794e99c536d to your computer and use it in GitHub Desktop.
Save plembo/cc8e037f3adddfa56d2d1794e99c536d to your computer and use it in GitHub Desktop.
Bulk rename files with bash

Bulk rename files in bash

Needed to rename a bunch of files and didn't want to write a program. Bash one-liner below did the job.

I had a VMware guest I wanted to clone. Copied the whole guest directory to another but then had to rename all the files within. Here's my command syntax for that:

ls linuxc* | awk '{print("mv "$1" "$1)}' | sed 's/linuxc/linuxd/2' | /bin/sh

Found this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment