| 4D v20.1COPY DOCUMENT | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | 
    4D v20.1
 COPY DOCUMENT 
         | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| COPY DOCUMENT ( sourceName ; destinationName {; newName} {; *} ) | ||||||||
| Parameter | Type | Description | ||||||
| sourceName | String |   | Pathname of file or folder to be copied | |||||
| destinationName | String |   | Name or pathname of copied file or folder | |||||
| newName | String |   | New name of copied file or folder | |||||
| * | Operator |   | Override existing document if any | |||||
The COPY DOCUMENT command copies the file or folder specified by sourceName to the location specified by destinationName and, optionally, renames it.
Note that you can pass a file in the sourceName parameter and a folder in the destinationName parameter, in order to copy a file into a folder.
The optional newName parameter, when it is passed, renames the document copied to its destination location (file or folder). When it is passed in the context of copying a file, this parameter replaces the name (if any) passed in the destinationName parameter.
The following example duplicates a document in its own folder:
 COPY DOCUMENT("C:\\FOLDER\\DocName";"C:\\FOLDER\\DocName2")The following example copies a document to the database folder (provided C:\\FOLDER is not the database folder):
 COPY DOCUMENT("C:\\FOLDER\\DocName";"DocName")The following example copies a document from one volume to another one:
 COPY DOCUMENT("C:\\FOLDER\\DocName";"F:\\Archives\\DocName.OLD")The following example duplicates a document in its own folder overriding an already existing copy:
 COPY DOCUMENT("C:\\FOLDER\\DocName";"C:\\FOLDER\\DocName2";*)Copying a file into a specific folder while keeping the same name:
 COPY DOCUMENT("C:\\Projects\\DocName";"C:\\Projects\\")Copying a file into a specific folder while keeping the same name and overriding the existing document:
 COPY DOCUMENT("C:\\Projects\\DocName";"C:\\Projects\\"; *)Copying a folder into another folder (both folders must already be present on the disk):
 COPY DOCUMENT("C:\\Projects\\";"C\\Archives\\2011\\")The following examples create different files and folders in the database folder (examples under Windows). In each case, the "folder2" folder must exist:
 COPY DOCUMENT("folder1\\name1";"folder2\\")
  //creates the "folder2/name1" file
 
 COPY DOCUMENT("folder1\\name1";"folder2\\" ; "new")
  //creates the "folder2/new" file
 
 COPY DOCUMENT("folder1\\name1";"folder2\\name2")
  //creates the "folder2/name2" file
 
 COPY DOCUMENT("folder1\\name1";"folder2\\name2";"new")
  //creates the "folder2/new" file (name2 is ignored)
 
 COPY DOCUMENT("folder1\\" ; "folder2\\")
  //creates the "folder2/folder1/" folder
 
 COPY DOCUMENT("folder1\\" ; "folder2\\" ; "new")
  //creates the "folder2/new/" folder
	Product:  4D
	Theme:  System Documents
	Number:  
        541
        
        
        
	
	Created:  4D v6
	Modified:  4D v13
	Modified:  4D v14
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	4D Language Reference ( 4D v20)
	
	
	4D Language Reference ( 4D v20.1)
	
	
	
 Add a comment
Add a comment