I want to recursively remove a substring from all files. I'm trying with the following command but it doesn't work:
❯ find . -name 'foobar*' -exec rename -vn 's/foobar//g' {} \;
rename: not enough arguments
Try 'rename --help' for more information.
I've added the options v
and n
to print instead of making changes.
I've also tried without the find
part with no luck:
rename -nv "foobar" "" *
rename: invalid option -- ' '
Try 'rename --help' for more information.
The rename that I'm using says that it's part of the util-linux
package.
I believe this is happening because there are files in the folder that start with a hypen.