Copy folder with parent

[code]@nofilenamequoting

@set from={filepath$|noterm}
@set to={destpath|noterm}{filepath$|..|noroot|noterm}

Say FROM0: {$from}
Say FROM1: {filepath$|noterm}
Say TO0 : {$to}
Say TO1 : {destpath|noterm}{filepath$|..|noroot|noterm}

Say CreateFolder NAME="{$to}"
Say Copy FILE="{$from}" TO="{$to}"

CreateFolder NAME="{$to}"
Copy FILE="{$from}" TO="{$to}"
[/code]
Seems to do what you want? o)
Remove the "Say" lines, I used them for debugging (or leave them and install this: Command: Say (print text to the script console)) Very handy for toying around with paths and commands and also may avoid some screw ups.

@devs
Because I had weird results and then decided to "echo" what the final commandsline(s) would look like, I noticed that "{destpath|noterm}" can only be used once (it seems). Is that possible? When used a second time, this expression is empty.

The button script above shows following output, note that "TO1" is not equal to "TO0":
Command.Generic: Say: FROM0: C:\ProgramData\GPSoftware\Directory Opus\Script Addins\Command.Generic_SelectEx.js
Command.Generic: Say: FROM1: C:\ProgramData\GPSoftware\Directory Opus\Script Addins\Command.Generic_SelectEx.js
Command.Generic: Say: TO0 : D:\tmp\2015_03_16 02-02-17\ProgramData\GPSoftware\Directory Opus\Script Addins
Command.Generic: Say: TO1 : \ProgramData\GPSoftware\Directory Opus\Script Addins
Btw, this is where the oldschool button mechanics really rock!
I miss these powerful string and path manipulations in "OnClick()". o)