Is there a way to cut paths like this in a command?

Hello..

My question is, is there a way to cut a path like this:

Original path: d:\Video\Anime\animepath
Wanted path: d:\Video\ToBeWritten\animepath

My intention is to create a button which creates and changes the destination path to the wanted one based on which directory is the source.

Currently I use this:

CreateFolder "d:\video\tobewritten\{sourcepath|nopath}"
go OPENINDEST "d:\video\tobewritten\{sourcepath|nopath}"

which works very well, EXCEPT when there's subpaths too, like this:
d:\Video\Anime\Comedy\animepath

I have tried fiddling with the .... option, but that doesn't work well because it starts from the beginning (d:....) instead of the end.

Any ideas?

Sorry for my english, it's not my native language.

Apparently nobody knows..
Not if it can be done or not either??

I was hoping there was some way to specify it should use the last n elems of the path.

In other words, it would return something like this:
"Comedy\animename"
if the full path was d:\video\anime\Comedy\animename

Well, I guess tcc is needed then.

You can use {sourcepath|..} to get the parent path, and .... to get the one above that, and so on. From Opus 9.1.1.6 onwards they can be combined with nopath as well. e.g.

{sourcepath|nopath}
{sourcepath|..}
{sourcepath|....}
{sourcepath|..|nopath}
{sourcepath|....|nopath}

Not sure if that's what you want or not.

@leo, those do the exact opposite (it cuts the path starting at the rightmost item)..

I'm looking for a way to cut the n leftmost parents, i.e the topmost ones.

Example: If the original path is D:\Video\Anime\Comedy\Animename
then I want to remove D:\Video\Anime\ and keep the remainder.

Apparently it doesn't currently exist in DO, otherwise someone would've found it by now I guess.. Perhaps time for a suggestion or something..

I would use a bit of VBScript to do that.

That might work.. I'm not exactly used to write scripts for use directly in a command though..
Does it still support the {sourcepath} etc within the script? Using @script?

You can't use {sourcepath} etc. in the script directly.

If you are calling a separate .VBS file then you should pass {sourcepath} etc. as arguments to the script. An example which does that is here:

[One Hotkey for 2 commands)

If you want to avoid having a separate .VBS file and want the script to exist in the button itself then, at the moment, you have to abuse the Rename Scripting feature. Information on that can be found here:

[[OBSOLETE] "Abusing" Rename Scripts to do other things with file info)

[quote="leo"]You can't use {sourcepath} etc. in the script directly.

If you are calling a separate .VBS file then you should pass {sourcepath} etc. as arguments to the script. An example which does that is here:

[One Hotkey for 2 commands)

If you want to avoid having a separate .VBS file and want the script to exist in the button itself then, at the moment, you have to abuse the Rename Scripting feature. Information on that can be found here:

[[OBSOLETE] "Abusing" Rename Scripts to do other things with file info)[/quote]
I guess I'll give try this.. TCC doesn't obey the @runmode command (or DO doesn't apply it), and the fullscreen flash is rather annoying, so if it can do the trick somehow, I'll be happy.

There really should've been a implemented way to achieve the same (cut from left, using same syntax) though..

Try changing the button to MS-DOS Batch type. That may prevent TCC's window from appearing if TCC is a command-line program and you've specified "@runmode hide"