I am using rename available in ubuntu:
$ rename --version
/usr/bin/rename using File::Rename version 0.20
This is what my directory looks like:
$ tree .
.
├── awp-3
├── bar
│ └── wp-2
└── wp-foo
└── wp-1
My goal is that I want to rename all files and folders with the prefix wp- to static-
This is what I ran:
$ shopt -s globstar
$ rename -n 's/wp-/static-/' **
rename(awp-3, astatic-3)
rename(bar/wp-2, bar/static-2)
rename(wp-foo, static-foo)
rename(wp-foo/wp-1, static-foo/wp-1)
This is almost what I want. The file awp-3 should not have been renamed.
So I did this instead:
$ rename -n 's/^wp-/static-/' **
rename(wp-foo, static-foo)
rename(wp-foo/wp-1, static-foo/wp-1)
For some reason, this didn't change the filename of wp-1 or wp-2.