Rename to "clipboard text"

Hi, it is possible to rename multiple files with same name but different extensions into different same name (from text copied to clipboard) and keep all extensions by one command or script? Example: I have files movie.txt , movie.ccd and movie.srt in same directory. I copied text "film" to clipboard. I'd like to rename those files to film.txt , film.ccd , film.srt . Actually, command
Rename FROM "some name here".* TO PATTERN works, but I still have to do lot of work manually (paste new file name in dialog, click ok, same for next file, etc). So, it's possible to automate this?

You have not given us enough information to really answer this. On the surface I'd do this, not with a button, but with the standard DOpus renaming tool. However that will only rename one set of files at a time.

If you are asking what I think you are asking, meaning you want to process a directory full of files in this way, then I suspect you would have to resort to an external script launched by DOpus.

Maybe this might do what you're trying to do?

dopusrt /cmd Rename from {file$|noext}.* to {dlgstring|Specify new file prefix}.*

It requires that you select at least ONE file with the 'same (prefix) name' in order to feed the command the file$ part of the control code - which then sets the overall rename FROM pattern by stripping the extension (|noext) and then replacing it with .* so you can keep the wildcarded extension in the rename TO pattern...

This still requires that you manually hit CTRL+V to paste your clipboard text in the dialog window that pops up from using dlgstring... but at least it should only be once.

Hmmm... looking at my suggestion above - it seems like a good case for a feature request to make an external control code to access the clipboard contents? So we could someday do something like:

dopusrt /cmd Rename from {file$|noext}.* to {fromclipboard}.*

What do you think John?

I believe {clip} is what you're looking for :slight_smile:

[quote]
dopusrt /cmd Rename from {file$|noext}.* to {dlgstring|Specify new file prefix}.*[/quote]

Yeah, quite right Steje !
I've been reluctant to answer questions like these because of DOpus Pattern Mathing Syntax.
Filenames with ( , ) , [ , ] , #, ~ , ' characters won't be renamed with this button.

An even better feature request is the option to turn DOpus Pattern Matching Syntax OFF.

It's easy to write a C++ program to circumvent this, but I'm working on a more flexible general solution.
I'm beginning to attempt to organize some 'hello world' ideas for a PHP command line scripting tutorial.

Per chance, have you used UltraEdit Studio ?
If so, I'd be interested in discussing some things and simple alternatives with you via email.
Interested ?

:opusicon: porcupine

Thanks for help. As I understood, there is not yet such argument as {clipboard} or {paste} or something like that for RENAME function, maybe in feature... I think , command line with manually "paste" only one time will be very helpfull for me.
Thanks again

pav... I think you've got the answer:

dopusrt /cmd Rename from {file$|noext}.* to {clip}.*The only caveat is that it won't work properly for filenames with the characters Porc mentioned... Good catch Porc, you've gained a supporter for disabling pattern matching.

Hey Jon, if you're watching... I looked in a bunch of spots and couldn't find any metnion of {clip}... is it an un-documented feature or did I just miss it somewhere in the documentation?

To steje:

dopusrt /cmd Rename from {file$|noext}.* to {clip}.*

Excellent! That's exactly was I needed! Thank you very match!

dont work for me :cry:

i have some files like

"aaa.txt"
"bbb.txt"
"ccc.txt"

Here it works fine,

but if i have files like this

"2008 aaa.txt"
"2008 bbb.txt"
"2008 ccc.txt"

or

"#aaa.txt"
"!bbb.txt"
"#ccc.txt"

nothing happens

all files with the space or characters inside

[b]Greetings from Germany

Dennis[/b]

With Opus 9 you can use this (no "dopusrt /cmd" required):

Rename PATTERN * TO "{clip}.{ext}" FILEINFO AUTORENAME

The AUTORENAME argument is optional and tells Opus to automatically add a number to the end of the name if there's already a file with the same name. (For example, if you rename two files with the same extension using this button.)

[quote="leo"]With Opus 9 you can use this (no "dopusrt /cmd" required):

Rename PATTERN * TO "{clip}.{ext}" FILEINFO AUTORENAME

The AUTORENAME argument is optional and tells Opus to automatically add a number to the end of the name if there's already a file with the same name. (For example, if you rename two files with the same extension using this button.)[/quote]

THX, i love it, works 100%
on files and dirs

CU Dennis

OK Nudel,
Fair enough, I'm about ready to put my dunce cap on here,
but I have one question.

This operates on all files,
be they selected or not,
in the current working directory.Rename * TO "{clip}.{ext}" FILEINFO AUTORENAME

I would have thought that your code

Rename PATTERN * TO "{clip}.{ext}" FILEINFO AUTORENAME was equivalent.
It does seem to be true solution though as it only operates on selected files.

Hence, use of the only recent escwild control code modifier is unnecessary to execute this rename on selected files only.

Well, the manual isn't clear about this in either case.
No excuses here ... but ....
I know I've used Pattern from within a crude script or CL program using Dopusrt /cmd.

Regards,
David

Edit Note: I'll think about it and report back more specific ideas and data.

Rename * TO "blah" is the same as Rename FROM=* TO="blah". The purpose of the FROM argument is to make the Rename command ignore the file selection and to instead work on all files matching the given wildcard.

On the other hand, Rename PATTERN=* TO="blah" works on the selected files (only).

[quote="leo"]With Opus 9 you can use this (no "dopusrt /cmd" required):

Rename PATTERN * TO "{clip}.{ext}" FILEINFO AUTORENAME

The AUTORENAME argument is optional and tells Opus to automatically add a number to the end of the name if there's already a file with the same name. (For example, if you rename two files with the same extension using this button.)[/quote]

Well thanks for the guidance to make it work. I was able to make a button with this code and paste it on the toolbar.

Just one thing to ask, can I or how can I make this option appear when I select files/folder in the right click menu (dont know whether its called context sensitive menu or something).

Thanks.