I want to extend a recent question which I have asked to remove french characters with a combination of find and rename:

Rename files and directories with French characters

Now I am facing some files and directories with a \ in their names which is not touched by the following command:

find . -depth -execdir rename -n '
 utf8::decode$_ or die "cannot decode $_\n";
 s{[^\w.\@+,#!?:&%~()\[\]/\\ -]}{?}gs;
 ' {} +

I tried to use \\ to target that name but it seems to be the incorrect way. The file naming I am talking about looks like that:

'Links '

$ls -1b

Those dir names are causing PHP Code to break. For example when trying to move a file inside a dir with that naming.

How can I enhance the given command to also target the described names?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.