Help with copy command, distguish between file and directory

PHPBB_IMPORT_WARNING CODE_NEAR_LI

There are a couple of ways you can get this done right now. (A more direct way of doing it was requested a little while ago but I don't know when/if it'll be implemented, so these will have to do.)

[ol][li]The first method is to use a bit of VBScript glue. You make your Opus button pass the filename to a VBScript and it looks at the filename and does something different depending on whether it's a directory or a file. A VBScript which does just that can be found in this thread:

[One Hotkey for 2 commands)

In this case you could copy the file using VBScript itself, or you could have VBScript execute Opus commands via

"C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" /cmd <your command here>
[/li]
[li]Another way of doing it is to create two User Commands which are both called by your button. One user command will start with @dironly, and only affect directories, while the other will start with @filesonly, and only affect files.

You cannot mix @dironly and @filesonly in the same command but you can have a command which calls two user commands, each of which uses one or the other. This seems to work very well and the only disadvantage is that you have to create three things instead of one.

To set this up, go to Customize, click on the Commands tab and then the User category. Add a new user command called DateDupeDirs and make it run this:

@dironly Copy DUPLICATE WHENEXISTS=rename AS "{file|noext}_{date|yyyyMMdd}_{time|HHmm}"

Now add another user command, this time called DateDupeFiles and make it run this:

@filesonly Copy DUPLICATE WHENEXISTS=rename AS "{file|noext}_{date|yyyyMMdd}_{time|HHmm}{file|ext}"

Finally, make your actual button (or hotkey or menu item) run this:

DateDupeDirs DateDupeFiles

I just tried this and it seems to work great, as shown below.[/li][/ol]