Move files to ..\Archive directory

I want to move selected files to the Archive directory that is one level up from the current directory.

The following is not working:

@ifexists:..\Archive Copy {allfile} TO ..\Archive MOVE

I'm still on DOpus 11.


You don't want to use {allfile} with the Copy command. Just leave the list of files blank and it will automatically copy/move the selected files.

If that still does not work, split things up to see if the problem is with the first line or the second line.

This works:

Copy TO ..\Archive MOVE

and this does not:

@ifexists:..\Archive Copy TO ..\Archive MOVE

If the @ifexists isn't there and ..\Archive does not exist, I get this error:

@ifexists doesn't work with relative paths, only absolute paths.

(Technically, it does work with relative paths, but the paths aren't relative to what you'd expect or usually want to test against.)

Using a script to do the conditional logic is probably your best bet.

A script? Really?


[code]Option Explicit
Function OnClick(ByRef clickData)

Dim Path
Set Path = DOpus.FSUtil.NewPath
Path.Set clickData.func.sourcetab.path
Path.Add "Archives"
if DOpus.FSUtil.Exists(Path) Then
	clickData.func.command.SetDest Path
	clickData.func.command.RunCommand "Copy MOVE"
end if

End Function

Thanks, Jon.

I appreciate you writing it. My incredulity was that a simple 2-line "copy this 'here' if 'here' exists" has turned into a script (which turned out to be 2+10 lines long).

It works.

Again, thank you, kind sir.

Conditional logic for esoteric operations tends to require scripting of some kind. :slight_smile: @ifexists is one of the script-like kludges we had before Opus supported the real thing.