Filesystem-Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Filesystem-Commands >

Filesystem-Commands

REN. - Rename File/Dir

Previous Top Next


MiniRobotLanguage (MRL)

 

REN. Command

REName file or directory

 

NTFS-DirectWildcards_enabled_01

 

Intention

 

This command is used to rename files or folders.
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!

The REN. - Command, it will NOT MOVE Folders across devices. For example it will NOT move a Folder from drive D: to drive F:.

For this use the MOV.-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

REN.§§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.

 

2015-01-22 15_21_05-Safety-Warning _ SPR-Script

 

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

 

 

REN.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: REN. 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

REN.§§TAR|§§TAB

 

' Rename-Example with File-Timeout of 5 Seconds

REN.§§TAR|§§TAB|5

END.

 

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

See also:

 

    ATF - Append-to-File

    CFF. - Copy-From-File

    CTF - Copy-To-File

    COP. - Copy File

    SHF. - Shell-File-Operation

    MDF. - Make-Direktory-File

    MKD. - Make-Directory

    GLC. - Get-Line-Count

    IEF. / NEF. - If - exist - File

    LFF - Line-From-File

    WFF. - Wait-For-File

    DEL. - Delete File