ricard13 wrote:The intent is to remove all characters other than letters, numbers, underscores, or parentheses.
That's not what your regex would do, even if "y" in front would be a normal operator.
What you probably want is
- Code: Select all
rename -o 's/[^a-zA-Z0-9_()]//g'
And you want to make sure that works on one file as expected, before using it with find.
Although I don't know what the default rename is that we ship, if it's the perl one or the regular GNU util-linux one.
edit: AFAICT it's the basic util-linux one when you're referring to /usr/bin/rename - that one does not support regexes at all,
it only supports basic expressions and only a different syntax, not the perl one that you want to use. It also only does the first occurence.
SYNOPSIS
rename [options] expression replacement file...
DESCRIPTION
rename will rename the specified files by replacing the first
occurrence of expression in their name by replacement.
[...]
Maybe you want to try krename:
https://userbase.kde.org/KRename - it has a find & replace mode and also supports regexes, although the Qt ones, not standard PCRE.