You'll need to change the paths to suit. The CreateFolder you were using is redundant as XCOPY will create the folder as required. The "|noterm" addition to the {sourcepath$} argument simply tell Opus not to include the trailing backslash for the path.
The arguments used for xcopy are:
/T - Creates directory structure but does not copy files
/E - Modifies the /T argument to include empty folders
/I - Forces XCOPY to assume that the destination provided is a folder.
You can add "@runmode hide" as the first line to prevent the command prompt window flashing open.
Note: Xcopy doesn't cope if the source folder is the same as the destination so it falls over with a cyclic copy error if that's the case.
Actually, everything you did was fine... the problem is that XCOPY doesn't like the trailing backslash that Opus passes at the end of the {sourcepath} control code. Modify your button to the following and you should be good:
Note1: when "debugging" this sort of issue (particularly with 'batch mode' functions) it's often helpful to prepend an echo statement at the beginning of some of the commands... this way, you can see in the paused console window what all the variables and control codes are being expanded to, and from there start working with the "real" values being tossed aroung outside of Opus to see if external application calls fail when run manually, and figure out from there what's going wrong.
Note2: you can do the same sort of thing using the Opus Copy function and a 'folders only' copy filter, like so:
unzip and copy the attached filter file (folders.ofi) into the /dopusdata\Filters folder
edit a button or hotkey or however you're running the command (no need to make 'this' modified command an MS-DOS batch function type or 'user' command) to run simply: Copy AS FILTER=folders folders filter.zip (373 Bytes)
@tanis - It worked! It worked!! - the |noterm was all that was required. Of course, I immediately became a bit greedy and tried to make it such that I could define the sourcepath as a variable as well.
But using dlgfolder adds a trailing slash to the path and I can't use noterm to strip it out . I guess some kind of regex would work, but I haven't gotten that fancy yet . For now, I've hard-coded the sourcepath to an existing folder instead - that way, if ever have a brain-f*rt and click on the User command while in a different lister, I won't be screwed.
@steje Thank you very much for the tip on echo - I was struggling to figure out how to display the variable value. Which tells you how "good" I am at programming anything
If the destination folder is always the current month name then you might be able to make the button even more convenient using {date|MMMM} which will turn into July right now.
Well, regardless of whether you want to stick with Xcopy or go with the native Opus Copy function with a folder filter... either way will 'copy' your data.
Since you'd only ever be copying "one" folder, maybe you can write a button that will copy a select folder to a 'staic' folder name, then in the same button run a vbscript that we could write which would take the current date/month, and then do the "math" needed to figure out the "previous" months name, and let the script actually rename your copied 'static' folder name (say foo) to the desired monthly name...?
[quote="steje"]Well, regardless of whether you want to stick with Xcopy or go with the native Opus Copy function with a folder filter... either way will 'copy' your data.
Since you'd only ever be copying "one" folder, maybe you can write a button that will copy a select folder to a 'staic' folder name, then in the same button run a vbscript that we could write which would take the current date/month, and then do the "math" needed to figure out the "previous" months name, and let the script actually rename your copied 'static' folder name (say foo) to the desired monthly name...?[/quote]
Yes that sounds like it would be the only way to do it, if we want to do it completely via scripting. However, I have never really done any programming in VBScript, so I'm a bit of a loss where to begin.
I will see if I can find the time to poke around this weekend though!