Rename on filenames with Parenthesis

This command fails on filenames with parenthesis.
Rename FROM "{f}" TO "test" AUTORENAME IGNOREEXT

Parenthesis need to be escaped as they are wildcard characters.

There is a way to tell {f} code to escape wildcard characters, but you don't need to use that code at all here. Commands work on the selected files by default.

Use PATTERN instead of FROM here and it will use the selected files:

Rename PATTERN="*" TO="test" AUTORENAME IGNOREEXT

Greetings Leo, thanks for your response, please display the code to escape the wildcard (I tried Codes for passing filenames {f|escregexp} and {f|escwild} and neither worked.

escwild should work but there's no reason to use it here and it'll work better the way I showed.

Edit: Thinking some more, you'd need to use both FROM (full path without escwild) and PATTERN (just the name, with escwild, or simply * as in my example) for it to work properly. But there's no reason to use FROM at all if you just want it to work on the selected filenames. That's what happens automatically if you don't specify FROM at all.

I actually don't want to use a wildcard (Pattern) I needto use a filename with parenthesis as the file to be renamed.

Have you tried the command I gave? It does the same thing as your original command except that it works. :slight_smile:

There is no reason to use FROM or {f} here.

I know your code works and I respect your intellect however I need to pass a hardcoded filename. So I'm actually seeking to make the code below work.

Rename FROM "A:\boss (1).cs" TO "test" AUTORENAME IGNOREEXT

Just add PATTERN="*" to your command and it will work.

Thanks Leo, that's what I needed, I wasn't aware that PATTERN="*" worked in conjunction with the {f}.

I'm still confused about what you're doing.

If you're using hardcoded paths, using {f} (which inserts the selected file) doesn't make sense.

Do you mean the Rename command's File argument, rather than the {f} code that inserts the selected file?

I'm actually using a csharp script file to rename selected files from names in a text file.
For some reason the timeout command has suddenly stopped working.

That's running the Copy command not the Rename command. This is getting more and more confusing. :slight_smile:

Why are you using CSharp for this? Or rather, using CSharp is the easiest way to generate the list of files, why not rename the files in CSharp without involving Opus at all? You aren't really gaining anything from having a programming language ask Opus to rename the files when the programming language can rename things directly, and using time delays to wait for that to happen is not a good idea.

What are you actually trying to do, overall? It's hard to understand from tiny fragments of solutions that don't make much sense when we don't know what they're trying to do.