Automatically rename certain files copied or pasted to a folder

I periodically find myself manually copying files from certain webpages to a folder (using a DO lister as the source location). Many of these files are simply named "image.jpg" or "unknown.jpg". It becomes a bit tedious to have to manually tell DO to rename the new file. Would it be possible to set a property that automatically renames the new file either: (a) if being copied into a specific folder; or (b) if it has a name from some sort of whitelist?

You could make a button which uses the Copy command's WhenExists argument to rename the incoming files if they clash.

@ifpath can be used to make a button which runs different things in different paths, but it's contingent on the source not the destination path. Scripting can be used to run different commands in different paths while taking both source and/or destination into account.

Thanks for the suggestions, but I don't think either method will work. I have two windows open in my desktop: DO and my browser. I'm dragging an image from the browser into DO. When the file already exists (as if frequent with files named Image.jpg or Unknown.jpg) DO gives me the standard copy replace or rename dialog. That is the step I'm trying to circumvent. So, the expected behavior that I'd like to see would be DO sees that the file I'm dragging to DO already exists in that folder. Based on either general DO settings or settings for that particular folder, DO automatically renames the newer file without prompting.

1 Like

You can change the drag & drop events to run anything you want.

The Copy command will also work between two windows (as long as the source window isn't a dual file display), and scripting can use whatever rules you want for the source and destination.

Are they triggered by files dragged into a lister from a browser? I have the impression Opus uses internally something like Clipboard PASTE for this, which makes it hard to intercept.

1 Like

Oops, I missed that detail. How it's handle can depend on the source side of the drag, and whether it's dropping a real file or a virtual file / stream. There isn't always a lot of control over what happens in the latter case.

Dropping to a temp dir and then having a hotkey or similar which automatically moves and renames the file might be the best bet. Or dropping on the folder you want things in and then using a button or hotkey which adds the current date/time to any file names that don't already have it. That would be a quick way to ensure the name won't be in use the next time you want to drop a file there from a browser.

1 Like

Hi, Leo,
I read your response and this thread with great interest because I often copy or move files between directories, using dual listers and they often contain duplicates. Could you point me to the scripting to which you refer and/or the making a button? Please bear in mind I am an absolute n00b at this so forgive me if this had been explained else where. And just so you know my mind melts at the level at which you wonderful experts discuss this so.....any pointers for a n00b? Many Thanks Riley,

1 Like

For making buttons:

For learning the commands and/or scripting, click Opus Manual at the top-right of the forum and there are quick links in there to the pages about all the commands as well as the introduction to scripting.

1 Like

Thank you!!! :man_bowing: