Copying files

Use the copy command to upload or download an image file, configuration file, or other file types to or from a flash device or an FTP/TFTP server.

Use the copy command to copy files.

The copy command supports wildcards.

Use the recursive keyword to recursively copy files and directories. If files or directories already exist, the operator is prompted to overwrite them. When the force keyword is specified, a positive response to the overwrite prompts is assumed. The operator is not prompted for confirmation and the existing files or directories are overwritten.

    file
        — copy [source-url] string [destination-url] string [client-tls-profile string] [direct-http] [force] [proxy string] [recursive] 

The following example copies the md-config.cfg file to the test_dir1 directory.

[/file "cf3:\"]
A:admin@node-2# list test_dir1

Volume in drive cf3 on slot A is TIMOS_VM_CF.

Volume in drive cf3 on slot A is formatted as FAT32

Directory of cf3:\test_dir1

09/29/2021  05:07p      <DIR>          ./
09/29/2021  05:07p      <DIR>          ../
               0 File(s)                      0 bytes.
               2 Dir(s)                14458880 bytes free.


[/file "cf3:\"]
A:admin@node-2# list

Volume in drive cf3 on slot A is TIMOS_VM_CF.

Volume in drive cf3 on slot A is formatted as FAT32

Directory of cf3:\

09/28/2021  11:43a                 931 BOF.CFG
09/28/2021  11:43a                 165 NVRAM.DAT
09/28/2021  04:34p               11319 bootlog.txt
09/28/2021  03:50p               11259 bootlog_prev.txt
04/16/2014  10:15a                   0 config.cfg
09/29/2021  05:08p               11319 md-config.cfg
09/28/2021  04:34p                 319 nvsys.info
04/16/2014  10:15a      <DIR>          syslinux/
09/29/2021  05:08p      <DIR>          test_dir1/
04/16/2014  10:15a      <DIR>          timos/
               7 File(s)                  35312 bytes.
               3 Dir(s)                14458880 bytes free.


[/file "cf3:\"]
A:admin@node-2# copy md-config.cfg test_dir1
Copying file cf3:\md-config.cfg ... OK
1 file copied.

[/file "cf3:\"]
A:admin@node-2# list test_dir1

Volume in drive cf3 on slot A is TIMOS_VM_CF.

Volume in drive cf3 on slot A is formatted as FAT32

Directory of cf3:\test_dir1

09/29/2021  05:07p      <DIR>          ./
09/29/2021  05:07p      <DIR>          ../
09/29/2021  05:09p               11319 md-config.cfg
               1 File(s)                  11319 bytes.
               2 Dir(s)                14447104 bytes free.

The following example displays a recursive move of the recursive4 directory to recursive5:

[/]
A:admin@node-2# file list

Volume in drive cf3 on slot A is SROS VM.

Volume in drive cf3 on slot A is formatted as FAT32

Directory of cf3:\

09/19/2021 06:11p 196 BOF.CFG
09/19/2021 06:11p 0 CONFIG.CFG
09/19/2021 06:11p 101 NVRAM.DAT
09/19/2021 07:22p SUPPORT/
09/19/2021 06:11p SYSLINUX/
09/19/2021 06:11p TIMOS/
09/23/2021 09:03a 27459 bootlog.txt
09/20/2021 09:56a 27326 bootlog_prev.txt
09/23/2021 01:21p 319 nvsys.info
09/23/2021 02:42p recursive4/
09/23/2021 08:22a ssh/
7 File(s) 55402 bytes.
7 Dir(s) 612311040 bytes free.

[/]
A:admin@node-2# file copy recursive4 recursive5 recursive
Copying directory cf3:\recursive4
Copying directory cf3:\recursive4\recursive2
Copying file cf3:\recursive4\recursive2\file2.txt ... OK
Copying file cf3:\recursive4\recursive2\file3.txt ... OK
Copying file cf3:\recursive4\file1.txt ... OK
2 dir(s) and 3 file(s) copied.