www.icetips.com  Icetips Utilities Documentation 8/29/2014    

Shell Class:  CopyFiles

Previous  Top  Next  


Prototype: (String pSource, String pDestination, Byte pCopyFilesOnly=True, Byte pCopySubDirs=False, Byte pConfirmCreateDest=False, Byte pSimpleProgress=False,Long pExtraAttrib=0, Byte pReplaceAttrib=0),Long,Proc

 

pSourceThe source folder and files.  This can be a NULL character separated string with a list of fully qualified filenames. 
pDestinationDestination folder or file. 
pCopyFilesOnlySet to True if you want to copy only files.
pCopySubDirsSet to True if you want to copy subfolders as well.
pConfirmCreateDestSet to True to confirm creation of the destination folder(s)
pSimpleProgressSet to True if you want to display a simple progress window.
pExtraAttribExtra attributes/flags used in the fFlags field in the SHFILEOPSTRUCT
pReplaceAttribCan only be specified with pExtraAttrib.  If it is set to true, the complete attribute set is replaced.  If it is set to false, the pExtraAttrib value is added to the FileOp.fFlags property.

 

ReturnsReturns 0 if the operation was successful.  If the operation failed it returns a standard windows error code.  See http://msdn.microsoft.com/en-us/library/bb762164.aspx for additional information on old error codes that this method can still return.  To get the error code and formatted error message use the LastAPIError or LastAPIErrorCode class properties.

 

This method is designed to copy files from one place to another.  Internally it uses SHFileOperation to accomplish that.

 

Please see http://msdn.microsoft.com/en-us/library/windows/desktop/bb759795(v=vs.85).aspx for information about what flags you can specify in the pExtraAttrib.  Here are two examples on how to deal with a situation when you are copying files to a destination folder where the file exists

 

IT_FOF_RENAMEONCOLLISION will not prompt user but will create a new filename GLPOST - Copy.csv  As for subsequent copy again, the filename will be GLPOST - Copy(2).csv

 

IT_FOF_NOCONFIRMATION will not prompt user and overwrite the existing file. 

 

Example:

If Message('Are you sure that you want to copy "' & Clip(Loc:Source) & '" to "' & Clip(Loc:Destination) & '"?','Copy Files?',|

           ICON:Question,Button:Yes+Button:No,Button:No) = Button:Yes

  ! Copy the files

  ITS.CopyFiles(Loc:Source,Loc:Destination)

End

 

 

See also:

Windows System Error Codes on MSDN

SHFileOperation documentation on MSDN - including old error codes.

 

 



Direct link to this page: http://www.icetips.com/manuals/utilities/copyfiles_shellclass.htm