MOVE        Move one local file to another location

<< Click to Display Table of Contents >>

Navigation:  Robo-FTP User's Guide > Script Programming > Script Commands > All Script Commands >

MOVE        Move one local file to another location

Syntax:

MOVE

[ src file ]  [ dest file ]

Arguments:

[ src name ]

Variable or string defining a file or path name; if no path is defined Robo-FTPs working folder is used. Wildcards are supported.

 

[ dest name ]

Variable or string defining a file or path name; if no path is defined Robo-FTPs working folder is used.

Options:

/subdirs

Search sub-directories for files matching wildcards in src_name and if all files in a directory are moved delete the now empty source directory

 

/emptydirs

Move empty directories as well.

 

/flat

Move all files found to the destination directory without sub-directories. Empty directories in the source location are deleted. If multiple files in the source tree have the same name this can result in loss of information as only the last one moved will still exist at the end.

 

/allowerrors

Continue trying to move files after one fails to move.

 

/copydirs

When moving a file copy the files sub directories relative to the current working directory to the destination.

 

 

This script command moves the source file (copies and deletes) to the destination location.

 

The following is a valid command and will work correctly assuming C:\test\file exists and C:\test2 exists  and is a directory.

 

MOVE "c:\test\file" "c:\test2\file"

 

If test2 is an existing folder, the following moves a file to the folder while retaining the original file name.

 

MOVE "c:\test\file" "c:\test2"

 

Otherwise, file is moved to the root folder of drive C: and renamed to test2.

 

The following moves all files and folders in C:\test to C:\test2. Effectively this renames test to test2.

 

MOVE "c:\test" "c:\test2" /subdirs /emptydirs

 

The following moves all files and folders in C:\test to C:\test2\test. Effectively this renames C:\test to C:\test2\test.

 

MOVE "c:\test" "c:\test2\" /subdirs /emptydirs

 

After that command is complete there will be no folder C:\test left and c:\test2 will contain all the files and folders that used to reside in C:\test.

 

The following moves all files and folders in C:\test to C:\test2 but leaves C:\test existing after it is complete.

 

MOVE "c:\test\*" "c:\test2" /subdirs /emptydirs

 

If you omit the path name portion of an argument, Robo-FTP assumes that the file is (or will be located) in the working folder. For example, the following moves a file from the current working folder:

 

MOVE "file" "c:\test2\file"

 

After any files have been moved, the %copyfiles internal script variable is automatically populated with the destination path of all such files.

 

Use the FTPRENAME command to move files on a remote site.

 

 

Related command(s): RENAME, FTPRENAME, MAKEFILENAME, COPY, APPEND, DELETE, DOSCMD, WORKINGDIR, Using the %copyfiles Variable