Command: RenameFromClipboard

Thanks for your feedback! o) What's it exactly that's so slow?

The renaming of course, it takes 15 seconds to rename 200 items.

15 secs for 200 items sounds slow indeed, maybe things get quicker if you move the lines..
..out of the outer for-loop in RenameSelectedItemsFromClipboard(). All rename commands then will be executed in a batch fashion.
(Edited to keep thread compact)

I'm not familiar with the script language your using, but I'm a coder in a different language.
I edited your code a little and this seems to work just fine...

[code block removed as you can now get the change from the updated script in the main post]

The following line needed to be moved out too...
var cmd = DOpus.NewCommand()

I wonder why you executed the actions one at a time?!

Sorry for not mentioning the other needed change, but you are skilled it seems. o) Is it any faster with that batch mode now?

I guess because the script hasn't reached a major version yet, so code isn't necessarily fine-tuned to the max. o)

Updated to v0.2.1

  • performance gain by reusing the command object for all rename operations (28 vs. 4secs = 700% speed increase for 200 files on my AMD quad idling at 1Ghz)

I did not expect such a speed-increase with this little tweak, good to know for upcoming scripting projects - you live and learn! o)
Thank you tuseday for being unsatisfied! o) (Please edit your post and remove any code to keep thread/posts compact, thanks!)

I installed the script and it's excellent. How do I go about modifying the script so that I can change the names of multiple files to the same name with sequential numbers? Example: change the following three file names, "stupid" "dumb" "ugly" using the word Smart (from the clipboard) in order to change to Smart 01, Smart 02, Smart 03. etc. Thank you for writing this script. It's quite useful already.

Unfortunately, this command can't do that, but you can use the builtin rename tool/command if I understood you correctly, it has support for sequential numbering. In case you need detailed help on this, I suggest you open a new thread in the general support section.

Thanks tbone, I use the rename tool all the time, generally regular expressions works fine. I am always digging through the form and the manual in order to get more out of Dopus which I consider the most essential software in my computers. I stumbled on your script and I like it.

Thank you very much tbone, exactly what I was looking for (and tried in vain to do) :slight_smile:

Can this be worked into a single button that renames destination files based on source file names?

Maybe! Can you give an example? o)

Sure! Let's say I have a folder filled with Season 12 of The Simpsons that I ripped from DVD. Now let's say I buy it on Blu-Ray and rip better quality versions into a second folder.

It would nice to navigate to both folders, then hit a button to rename the new videos to match the names of the old videos.

That's what it's for.. o)

Select the files in the source and copy their names to the clipboard with "Clipboard COPYNAMES".
Then switch to destination, select the files to be renamed and run "RenameFromClipboard".

You could do all that in a single button, by selecting all, copying the names, toggling focus, selecting all in dest and running the renamefromclipboard command, but unless that's a task you do very regularly, I would suggest adding "RenameFromClipboard" to the context menu for all files and folders, so you have it at hand in other use cases as well. It takes a few more keystrokes then, but you are more flexible.

Thanks. I know that's what it's for - that's how I currently use it. I just wanted to save some keystrokes/mouseclicks since it's something I do a couple times a week lately.

Ok, sorry. I got you wrong then.. o)

Try this..

Select ALL
Clipboard COPYNAMES
Set FOCUS=toggle
Select ALL
RenameFromClipboard

Cool beans, thanks :slight_smile:

Slight edit, the second line should be Clipboard COPYNAMES=nopaths

Also, how can I tweak the script so it just copies file names, and not file extensions?

Try this..

RenameFromClipboard COMMANDS=Rename FILEINFO FROM="%item.realpath%" TO="%item.new_name%.{ext}"

Thanks tbone. That code keeps the source file extension though. So if I copy names from .avi files to .mkv files, I get:

Video File Name.avi.mkv