<< Click to Display Table of Contents >> Navigation: 3. Script Language > Filesystem-Commands > Filesystem-Commands |
MiniRobotLanguage (MRL)
MOV. Command
Move file or directory
Intention
This command is used to Move/rename files.
The command puts a 0 (Operation failed or was aborted) or a 1 (operation successful ) on the stack to show if the operation was successful or not.
The Command has a network timeout when used with files that are possibly openend.
The command in its default-settings does not ask for any confirmation and can do serious damages to your files and data.
Therefore be careful and use on your own risk!
Unlike the REN. - Command, it will also MOVE Folders across devices. For example it will move a Folder from drive D: to drive F:.
In this case, you may write:
MOV.d:\folder-to-move\|f:\
This will move the folder to
f:\folder-to-move\
This can not be done using REN.
This is the only difference to the REN.-Command.
§§FIA=<Filename A>
§§FIB=<Filename B>
MOV.§§FIA|§§FIB
ITO.
MBX.An Error occured!
EIF.
ENR.
To show that something is a folder, suffixe it with a "\".
' Is a file
§§FIA=C:\myname
' Is a folder
§§FIA=C:\myname\
If you want to have a Warning-Messagebox before the Command does any RENAME, use the OPT.-Command and the SAFEFILE-Setting.
§§FIA=<Filename A>
§§FIB=<Filename B>
' Using this setting will produce a Safety Message-Box before dangerous File-Operations using REN.
OPT.SAFEFILE|1
MOV.§§FIA|§§FIB
ITO.
MBX.An Error occured!
EIF.
ENR.
If you want to debug your Script safely, you can use the
OPT.SAFEFILE|1
this will bring up such a Messagebox for destructive File-Operations like DEL., RMD. REN. and DCP.
You can choose between
- "Yes" - this will start the requested file-operation
- "No" - this will prevent the requested file-operation and set the Timeout-Flag
- "Cancel" - this will prevent the requested file-operation and set the Timeout-Flag and end the script.
Syntax
MOV.P1|P2[|P3]
Parameter Explanation
P1 - Variable with source-file
P2 - Variable with Destination file
P3 - (optional) Timeout, only for renaming of files
Wildcards are not supported.
The Timeout will not be applied if directories shall be renamed.
For file-operations using wildcards and more options, use SHF.
Example
'*****************************************************
' EXAMPLE: MOV. and COP.
'*****************************************************
: §§PAT=F:\Testfiles
VAR.§§FIL=§§PAT\Audiograbber.zip
VAR.§§TAC=§§PAT\recent\Target.zip
: §§TIM=2
VAR.§§TAR=§§PAT\Target.zip
VAR.§§TAB=§§PAT\Targez.zip
COP.§§FIL|§§TAB
COP.§§FIL|§§TAB|(§§TIM+3)
' If Operation was successfull then Stack contains a 1 else a 0
PRT.$$000
IVV.$$000=1
PRT.Copy was successful
ELS.
PRT. There was an Error.
EVV.
' Rename-Example
MOV.§§TAR|§§TAB
' Rename-Example with File-Timeout of 5 Seconds
MOV.§§TAR|§§TAB|5
END.
Remarks
-
Limitations:
-
See also:
• IEF. / NEF. - If - exist - File