Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Copy Function

LabVIEW 2010 Help

Edition Date: June 2010

Part Number: 371361G-01

»View Product Info

Owning Palette: Advanced File VIs and Functions

Requires: Base Package

Copies the file or directory that you specify in source path to the location that you specify in target path. If you copy a directory, this function copies all its contents recursively to the new location. You cannot use this function to copy files into or out of an LLB.

Details  

prompt (Choose or enter file path) is the message that appears above the list of files and directories, or folder, in the file dialog box.
source path specifies an absolute path to the file or directory on which you want to operate. If you specify an empty or relative path, this function returns an error.
target path (use dialog) is the new absolute path for the file or folder on which you want to operate, including the new file or folder name. If target path is empty (default), the function displays a dialog box from which you can select a file or folder. If you specify an empty or relative path, this function returns an error. cancelled is TRUE if you cancel the dialog box.
overwrite determines whether the function replaces existing files or folders in the target path. If you overwrite a folder that contains unique files, LabVIEW moves those files to the new folder. (Mac OS X and Linux) LabVIEW does not overwrite read-only files, even if you set this parameter to TRUE.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
new path specifies the new location of the file or directory. If the operation is unsuccessful, this function sets new path to <Not A Path>.
cancelled is TRUE if you cancel the file dialog box. Otherwise, cancelled is FALSE, even if this function returns an error.
error out contains error information. This output provides standard error out functionality.

Copy Details

This function copies the original file or directory and renames the copy with the name that you specify in the last element of the target path. If target path is the path to an existing file, this function returns a Duplicate Path error. If target path is the path to an existing directory, the function places the new file or directory inside the existing directory using the original file or directory name.

For example, if you copy the directory c:\app to d:\app2, the function creates a new directory d:\app2 with the same contents as c:\app. The second time you copy the directory, the function creates a new subdirectory d:\app2\app and places the contents of app there. The third time you copy the directory, the function returns a Duplicate Path error.

This function also returns an error if the target path is an invalid path, such as if the specified parent directory is not valid.

Note  This function does not automatically append file extensions, such as .txt, to filenames when it copies or moves files. You must explicitly include the extension as a part of the new filename that you specify in target path.

If you do not have write permission for the file or directory that you specify in target path (use dialog), this function does not copy the file or directory and returns an error. Use the Set Permissions function to set the permissions for a file or directory.


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit