Skip to content

Copy_File

Include: Use System\FileSystem.pkg

See Also: File_Exist, Erase_File, Make_Directory, Rename_File

Purpose

Copies files or directory contents.

Syntax

Copy_File [FILE] {Source} to {Destination}

Arguments

FILE : Optional file driver. The FILE driver is optional; when omitted, file operations use FILE.

{Source} : Source file, folder, or wildcard pattern.

{Destination} : Destination file or folder.

Behavior

  • Copy_File FILE "source.txt" to "dest.txt" copies one file.
  • Copying a directory to an existing directory copies the contained files into the destination directory.
  • Copying a directory to a missing destination creates that destination.
  • *.txt copies top-level matches only.
  • **.txt copies recursive matches into the destination.

Example

Copy_File FILE "source.txt" to "dest.txt"
Copy_File "test1" to "test2"
Copy_File "test1/*.txt" to "test2"
Copy_File "test1/**.txt" to "test2"