Action: Move file and replace by shortcut?

How can I achieve this (probably with a File Type event?):

When I drag AFile from DirA to DirB then AFile is moved to DirB and a shortcut is created in DirA which points to AFile in DirB.

Thanks for any help!

Well if it were me I'd set up a dual lister with DIR A on one side and DIR B on the other side. Then I'd select the file(s) I wanted, and right click drag them to DIR B choosing MOVE when I released the right mouse button. Then I'd select the same files again in DIR B and do the same thing back to DIR A only this time when I released the right mouse button I'd choose CREATE SHORTCUT.

Thank you for the hint, however it would be nice, when moving the files from DirA to DirB, to have a command like this: MOVE AND REPLACE BY SHORTCUT. Would it be possible to create this command with a script?

Here's a button that will do it. Adding it to the drop menu is left as an exercise for the reader.

<?xml version="1.0"?> <button backcol="none" display="label" textcol="none"> <label>Move and Make Shortcut</label> <tip>Move a file and make a shortcut to replace it</tip> <icon1>#newcommand</icon1> <function type="normal"> <instruction>Copy MOVE</instruction> <instruction>Copy &quot;{destpath$}{file}&quot; TO {sourcepath} MAKELINK </instruction> </function> </button>

Is it possible to specify a template that relects the filename extension ?

As my understanding as of now would think,
prepending the commands ( instructions ) with dopusrt /cmd and run as a DOpus function, ultimately fails to produce the desired results.
And as a batch file using dopusrt /cmd it ultimately utterly fails.

Thanks Jon, that helps alot.
I now know by at least a fair 'experiment' and by good trust of this Resource Centre post of yours that I can use copy/move in this way.
I had suspected as much, but this 'toggles the switch' for me.

But then,
I'll probably find I've known this before and either it was somehow lost and forgotten,
or it later became confused with something else.
I'll set anchor here tonight.

Thanks Much,
David

Do you mean you want the created shortcut's name to include the original file's extension (instead of just the main filename part), or something else?

[quote]As my understanding as of now would think,
prepending the commands ( instructions ) with dopusrt /cmd and run as a DOpus function, ultimately fails to produce the desired results.
And as a batch file using dopusrt /cmd it ultimately utterly fails.[/quote]
There's no need to use dopusrt /cmd in the Opus button. It also won't work in a .bat file because it's using things like {destpath$} and {file} which don't have any meaning in a .bat file.

Yes, so that if there are two files of the same name , but different extensions,
it is easier to know which shortcut is which without either looking at the shortcut's properties or running it.

Agreed .
I was only investigating how the copy command was processed when using dopusrt.

On occassion, I write external PHP command line scripts or DOS batch files using 4NT and call them from a button.
Of course, control codes such as {destpath$} and {file} can be passed to an external batch file as %1 , %2 , ... , .
Again, I was only investigating how the copy command was processed when using dopusrt .
And of couse to run the DOpus Copy command in an an external batch file, such as a 4NT script, dopusrt is needed.

[quote="jon"]Here's a button that will do it. Adding it to the drop menu is left as an exercise for the reader.

<?xml version="1.0"?> <button backcol="none" display="label" textcol="none"> <label>Move and Make Shortcut</label> <tip>Move a file and make a shortcut to replace it</tip> <icon1>#newcommand</icon1> <function type="normal"> <instruction>Copy MOVE</instruction> <instruction>Copy &quot;{destpath$}{file}&quot; TO {sourcepath} MAKELINK </instruction> </function> </button> [/quote]
Thank you very much for the code, but the Paste command does not work here. I have copied the code to the clipboard, then Settings -> File Types -> Directory Opus File Types -> All Files and folders -> File Type -> Drop Menu, invoked the Paste command with RMB on the Drop Menu list (see the attached screen-shot), then clicked the Paste command, but nothing happens?

No, that's why I said it's an exercise for the reader :slight_smile: You'll need to set up the command manually.

So the not working Paste command is a bug?

OK, here is my homework:

Copy MOVE Copy "{destpath$}{file}" TO {sourcepath} MAKELINK
It works perfectly, thank you!

Another question: Is it possible to make the shortcut name exactly the source-file name (just for this command, not system-wide), not "Shortcut to MySourceFile"?

Currently not, however this will be added in a future version.

It's not a bug. The XML that Jon provided is for a toolbar button, not a context menu item. The two things are similar but not interchangeable and you can't paste one where the other is expected.