COPY        Copy one local file to another location

Top  Previous  Next

Syntax:

COPY

[ 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.

 

[ dest name ]

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

Options:

/copydirs

Copies the file to a destination directory that corresponds to the directory path portion of the [ src name ] argument. Destination directories are created if necessary. The final destination directory is calculated relative to the current local working directory so this option requires that the source file(s) be located either in the working directory or a subdirectory of the working directory. This option is commonly used when variables like %nextpath or %difffilepath are passed to the [ file name ] argument.

 

 

Use this script command to copy the source file to the destination location.

 

For example, the following copies a file to a new folder and renames it.

 

COPY "c:\test\file" "c:\test2\file2"

 

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

 

COPY "c:\test\file" "c:\test2"

 

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

 

In this example, the /copydirs option is used to preserve the source directory structure in the destination folder:

 

:next

GETFILE "*"

IFERROR GOTO exit

COPY %nextpath "c:\destination" /copydirs

GOTO next

:exit

 

Wildcard characters are not permitted with this command. Use the DOSCMD script command if you need to copy, append, or move multiple files with a single command.

 

 

Related command(s): MOVE, RENAME, MAKEFILENAME, APPEND, DELETE, DOSCMD, WORKINGDIR