PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Procedure that is using each copied file (syntax 2 only)
  • Values returned by the procedure (Syntax 2)
  • Managing errors
  • Operating mode in Windows Vista (and later)
  • Creating directories during the copy
  • Equivalence
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Copies one or more files (regardless of their attributes).
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
WINDEVWEBDEV - Server codeReports and QueriesJavaPHPAjaxUser code (UMC)
// Copy "File.doc" to "FileCopy.doc"
Res = fCopyFile("C:\Directories\File.doc", "D:\Documents\FileCopy.doc")
Windows Mobile
// Copy a file
Res = fCopyFile("\Directories\File.psw", "\Documents\FileCopy.psw")
WINDEVWEBDEV - Server codeReports and QueriesJavaPHPAjaxUser code (UMC)
// Copy the files found in the "C:\MyImages" directory
// The sub-directories and their files are taken into account (frRecursive constant)
ResCopy = fCopyFile("C:\MyImages\*.*", "D:\MyFiles\", frRecursive)
Syntax

Copying a a file or a directory Hide the details

<Result> = fCopyFile(<Source File> , <Destination File or Directory> [, <Copy Indicator>])
<Result>: Boolean
  • True if the files have been copied,
  • False otherwise. To find out the error details, use ErrorInfo associated with the errMessage constant.
<Source File>: Character string (with quotes)
File to copy (up to 260 characters). This parameter can correspond to:
  • a file name. This file will be automatically sought in the current directory (returned by fCurrentDir).
  • a file name with its full or relative path. A UNC path can be used.
Special cases according to the platforms:
  • Versions 15 and later
    WindowsLinux This parameter can be in Ansi or Unicode format.
    New in version 15
    WindowsLinux This parameter can be in Ansi or Unicode format.
    WindowsLinux This parameter can be in Ansi or Unicode format.
  • Versions 15 and later
    AndroidAndroid Widget This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
    Reminder: In Android, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories, as well as onto the external memory (SDCard).
    New in version 15
    AndroidAndroid Widget This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
    Reminder: In Android, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories, as well as onto the external memory (SDCard).
    AndroidAndroid Widget This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
    Reminder: In Android, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories, as well as onto the external memory (SDCard).
  • Versions 17 and later
    iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
    Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
    New in version 17
    iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
    Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
    iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
    Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
  • Versions 17 and later
    Universal Windows 10 App Windows Phone: This parameter corresponds to a relative path in relation to the current directory. The current directory corresponds to the data directory of application.
    Reminder: Only the files found in the data directory associated with the application can be handled.
    New in version 17
    Universal Windows 10 App Windows Phone: This parameter corresponds to a relative path in relation to the current directory. The current directory corresponds to the data directory of application.
    Reminder: Only the files found in the data directory associated with the application can be handled.
    Universal Windows 10 App Windows Phone: This parameter corresponds to a relative path in relation to the current directory. The current directory corresponds to the data directory of application.
    Reminder: Only the files found in the data directory associated with the application can be handled.
Management of wildcard characters (*,?): By default, the wildcard characters are allowed in the name of the file.
Special case according to the platforms:
  • Versions 18 and later
    Universal Windows 10 App The wildcard characters (*,?) are not allowed in the file name.
    New in version 18
    Universal Windows 10 App The wildcard characters (*,?) are not allowed in the file name.
    Universal Windows 10 App The wildcard characters (*,?) are not allowed in the file name.
  • Java If the "*.*" expression is used, only the files that have an extension will be copied.
  • PHP The wildcard characters (*,?) are allowed in the file path and in the file name.
  • Windows Mobile The wildcard characters (*,?) are not allowed.
<Destination File or Directory>: Character string (with quotes)
Destination file and/or directory (up to 260 characters). This parameter can correspond to:
  • a file name. This file will be automatically created in the current directory (returned by fCurrentDir).
  • a file name with its full or relative path. A UNC path can be used.
  • a full or relative path, only for a copy with wildcard characters.
If this parameter corresponds to a directory name, this name may (or may not) end with "\".
Special cases according to the platforms:
  • Versions 15 and later
    WindowsLinux This parameter can be in Ansi or Unicode format.
    New in version 15
    WindowsLinux This parameter can be in Ansi or Unicode format.
    WindowsLinux This parameter can be in Ansi or Unicode format.
  • Versions 15 and later
    AndroidAndroid Widget This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
    Reminder: In Android, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories, as well as onto the external memory (SDCard).
    New in version 15
    AndroidAndroid Widget This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
    Reminder: In Android, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories, as well as onto the external memory (SDCard).
    AndroidAndroid Widget This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
    Reminder: In Android, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories, as well as onto the external memory (SDCard).
  • Windows Mobile This parameter can correspond to:
    • a file name with its path.
    • a path, only for a copy with wildcard characters. If this parameter corresponds to a directory name, this name may (or may not) end with "\".
  • Versions 17 and later
    iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
    Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
    New in version 17
    iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
    Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
    iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
    Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
  • Versions 17 and later
    Universal Windows 10 App This parameter corresponds to a relative path in relation to the current directory. The current directory corresponds to the data directory of application.
    Reminder: Only the files found in the data directory associated with the application can be handled.
    New in version 17
    Universal Windows 10 App This parameter corresponds to a relative path in relation to the current directory. The current directory corresponds to the data directory of application.
    Reminder: Only the files found in the data directory associated with the application can be handled.
    Universal Windows 10 App This parameter corresponds to a relative path in relation to the current directory. The current directory corresponds to the data directory of application.
    Reminder: Only the files found in the data directory associated with the application can be handled.
<Copy Indicator>: Optional constant
Type of copy to perform:
frConfirmCopy a file and ask for confirmation before overwriting a file with the same name.
WEBDEV - Server codeAndroidAndroid Widget Universal Windows 10 AppPHP This constant is not available.
frProgressA progress window is displayed. If the file is small (a few bytes), the progress bar is not displayed.
WEBDEV - Server codeAndroidAndroid Widget iPhone/iPadUniversal Windows 10 AppJavaPHP This constant is not available.
frRecursiveRecursive copy of the files. The sub-directories and their files are taken into account.

<Copy Indicator> is empty by default. None of these options is selected.
Windows Mobile This parameter is not available.
Versions 19 and later
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppUser code (UMC)Stored procedures

Copying one or more files by handling each copied file Hide the details

<Result> = fCopyFile(<Source File> , <Destination File or Directory> , <Procedure Name> [, <Pointer> [, <Copy Indicator>]])
<Result>: Boolean
  • True if the files have been copied,
  • False otherwise. To find out the error details, use ErrorInfo associated with the errMessage constant.
<Source File>: Character string (with quotes)
File to copy (up to 260 characters). This parameter can correspond to:
  • a file name. This file will be automatically sought in the current directory (returned by fCurrentDir).
  • a file name with its full or relative path. A UNC path can be used.
The wildcard characters (*,?) are allowed in the name of the file.
Universal Windows 10 App The wildcard characters (*,?) are not allowed in the file name.
WindowsLinux This parameter can be in Ansi or Unicode format.
Windows Mobile Name and full path of the file to copy (up to 260 characters). The wildcard characters (*,?) are not allowed.
iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
<Destination File or Directory>: Character string (with quotes)
Destination file and/or directory (up to 260 characters). This parameter can correspond to:
  • a file name. This file will be automatically created in the current directory (returned by fCurrentDir).
  • a file name with its full or relative path. A UNC path can be used.
  • a full or relative path, only for a copy with wildcard characters.
If this parameter corresponds to a directory name, this name may (or may not) end with "\".
WindowsLinux This parameter can be in Ansi or Unicode format.
Windows Mobile Destination file and/or directory (up to 260 characters). This parameter can correspond to:
  • a file name with its path.
  • a path, only for a copy with wildcard characters.
If this parameter corresponds to a directory name, this name may (or may not) end with "\".
iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
<Procedure Name>: Character string (with or without quotes)
Name of WLanguage procedure ("callback" procedure) that will be called for each copied file. This procedure is used to handle the current file.
This procedure has the following format:
PROCEDURE <Procedure Name> (<Path of File to Copy>,
<Path of Destination File>, <Change>, <Procedure Pointer>)

The parameters of this procedure are optional.
There is no need to pass parameters to this procedure. Indeed, these parameters are automatically filled whenever a file is processed.
<Pointer>: Optional integer
Pointer passed to the <Procedure Name> procedure.
<Copy Indicator>: Optional constant
Type of copy to perform:
frRecursiveRecursive copy of the files. The sub-directories and their files are taken into account.

<Copy Indicator> is empty by default: the process is not recursive.
Windows Mobile This parameter is not available.
New in version 19
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppUser code (UMC)Stored procedures

Copying one or more files by handling each copied file Hide the details

<Result> = fCopyFile(<Source File> , <Destination File or Directory> , <Procedure Name> [, <Pointer> [, <Copy Indicator>]])
<Result>: Boolean
  • True if the files have been copied,
  • False otherwise. To find out the error details, use ErrorInfo associated with the errMessage constant.
<Source File>: Character string (with quotes)
File to copy (up to 260 characters). This parameter can correspond to:
  • a file name. This file will be automatically sought in the current directory (returned by fCurrentDir).
  • a file name with its full or relative path. A UNC path can be used.
The wildcard characters (*,?) are allowed in the name of the file.
Universal Windows 10 App The wildcard characters (*,?) are not allowed in the file name.
WindowsLinux This parameter can be in Ansi or Unicode format.
Windows Mobile Name and full path of the file to copy (up to 260 characters). The wildcard characters (*,?) are not allowed.
iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
<Destination File or Directory>: Character string (with quotes)
Destination file and/or directory (up to 260 characters). This parameter can correspond to:
  • a file name. This file will be automatically created in the current directory (returned by fCurrentDir).
  • a file name with its full or relative path. A UNC path can be used.
  • a full or relative path, only for a copy with wildcard characters.
If this parameter corresponds to a directory name, this name may (or may not) end with "\".
WindowsLinux This parameter can be in Ansi or Unicode format.
Windows Mobile Destination file and/or directory (up to 260 characters). This parameter can correspond to:
  • a file name with its path.
  • a path, only for a copy with wildcard characters.
If this parameter corresponds to a directory name, this name may (or may not) end with "\".
iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
<Procedure Name>: Character string (with or without quotes)
Name of WLanguage procedure ("callback" procedure) that will be called for each copied file. This procedure is used to handle the current file.
This procedure has the following format:
PROCEDURE <Procedure Name> (<Path of File to Copy>,
<Path of Destination File>, <Change>, <Procedure Pointer>)

The parameters of this procedure are optional.
There is no need to pass parameters to this procedure. Indeed, these parameters are automatically filled whenever a file is processed.
<Pointer>: Optional integer
Pointer passed to the <Procedure Name> procedure.
<Copy Indicator>: Optional constant
Type of copy to perform:
frRecursiveRecursive copy of the files. The sub-directories and their files are taken into account.

<Copy Indicator> is empty by default: the process is not recursive.
Windows Mobile This parameter is not available.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppUser code (UMC)Stored procedures

Copying one or more files by handling each copied file Hide the details

<Result> = fCopyFile(<Source File> , <Destination File or Directory> , <Procedure Name> [, <Pointer> [, <Copy Indicator>]])
<Result>: Boolean
  • True if the files have been copied,
  • False otherwise. To find out the error details, use ErrorInfo associated with the errMessage constant.
<Source File>: Character string (with quotes)
File to copy (up to 260 characters). This parameter can correspond to:
  • a file name. This file will be automatically sought in the current directory (returned by fCurrentDir).
  • a file name with its full or relative path. A UNC path can be used.
The wildcard characters (*,?) are allowed in the name of the file.
Universal Windows 10 App The wildcard characters (*,?) are not allowed in the file name.
WindowsLinux This parameter can be in Ansi or Unicode format.
Windows Mobile Name and full path of the file to copy (up to 260 characters). The wildcard characters (*,?) are not allowed.
iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
<Destination File or Directory>: Character string (with quotes)
Destination file and/or directory (up to 260 characters). This parameter can correspond to:
  • a file name. This file will be automatically created in the current directory (returned by fCurrentDir).
  • a file name with its full or relative path. A UNC path can be used.
  • a full or relative path, only for a copy with wildcard characters.
If this parameter corresponds to a directory name, this name may (or may not) end with "\".
WindowsLinux This parameter can be in Ansi or Unicode format.
Windows Mobile Destination file and/or directory (up to 260 characters). This parameter can correspond to:
  • a file name with its path.
  • a path, only for a copy with wildcard characters.
If this parameter corresponds to a directory name, this name may (or may not) end with "\".
iPhone/iPad This parameter can correspond to a full path or to a relative path in relation to the current directory (returned by fCurrentDir). This parameter is case sensitive.
Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application has the rights to write into its setup directory or into one of its sub-directories.
<Procedure Name>: Character string (with or without quotes)
Name of WLanguage procedure ("callback" procedure) that will be called for each copied file. This procedure is used to handle the current file.
This procedure has the following format:
PROCEDURE <Procedure Name> (<Path of File to Copy>,
<Path of Destination File>, <Change>, <Procedure Pointer>)

The parameters of this procedure are optional.
There is no need to pass parameters to this procedure. Indeed, these parameters are automatically filled whenever a file is processed.
<Pointer>: Optional integer
Pointer passed to the <Procedure Name> procedure.
<Copy Indicator>: Optional constant
Type of copy to perform:
frRecursiveRecursive copy of the files. The sub-directories and their files are taken into account.

<Copy Indicator> is empty by default: the process is not recursive.
Windows Mobile This parameter is not available.
Remarks
Versions 19 and later

Procedure that is using each copied file (syntax 2 only)

For each file found, fCopyFile automatically calls the <Procedure Name> procedure. This procedure is a local or global procedure.
To create this procedure:
  1. Create a global procedure (from the code editor: on the "Code" pane, in the "Procedures" group, expand "New" and select "New global procedure").
  2. Fill the procedure declaration as follows:
PROCEDURE <Procedure Name> (<Path of File to Copy>, <Path of Destination File>,
[ <Change>, [<Procedure Pointer>]])
  • <Path of File to Copy> is the path of the file to copy.
  • <Path of Destination File> is a character string containing the name of the destination file.
  • <Change> is an optional constant that is set to:
    • flFirstFile when the file is the first file copied into the <Source File> directory.
    • flChangeDir when the file is the first file listed in a sub-directory of <Path of Directory to Copy> (which means that a change of directory occurred).
    • flFile in all the other cases.
      The different values that can be taken by <Change> are as follows:
      Current file<Change>
      Dir\File 1flFirstFile
      Dir\File nflFile
      Dir\SubDir 1\File 1flChangeDir
      Dir\SubDir 1\File mflFile
      Dir\SubDir 2\File 1flChangeDir
      Dir\SubDir 2\File xflFile
  • <Procedure Pointer> is an optional integer whose value is the one passed to the <Pointer> parameter of fCopyFile. If <Pointer> is not specified, <Pointer> is set to 0.
To retrieve the value of <Procedure Pointer>, the value of <Procedure Pointer> must be assigned to the value of <Pointer> in the procedure by Transfer.
Note: The parameters of this procedure are optional: you can for example only specify the path of the file to copy and the path of the destination file.
New in version 19

Procedure that is using each copied file (syntax 2 only)

For each file found, fCopyFile automatically calls the <Procedure Name> procedure. This procedure is a local or global procedure.
To create this procedure:
  1. Create a global procedure (from the code editor: on the "Code" pane, in the "Procedures" group, expand "New" and select "New global procedure").
  2. Fill the procedure declaration as follows:
PROCEDURE <Procedure Name> (<Path of File to Copy>, <Path of Destination File>,
[ <Change>, [<Procedure Pointer>]])
  • <Path of File to Copy> is the path of the file to copy.
  • <Path of Destination File> is a character string containing the name of the destination file.
  • <Change> is an optional constant that is set to:
    • flFirstFile when the file is the first file copied into the <Source File> directory.
    • flChangeDir when the file is the first file listed in a sub-directory of <Path of Directory to Copy> (which means that a change of directory occurred).
    • flFile in all the other cases.
      The different values that can be taken by <Change> are as follows:
      Current file<Change>
      Dir\File 1flFirstFile
      Dir\File nflFile
      Dir\SubDir 1\File 1flChangeDir
      Dir\SubDir 1\File mflFile
      Dir\SubDir 2\File 1flChangeDir
      Dir\SubDir 2\File xflFile
  • <Procedure Pointer> is an optional integer whose value is the one passed to the <Pointer> parameter of fCopyFile. If <Pointer> is not specified, <Pointer> is set to 0.
To retrieve the value of <Procedure Pointer>, the value of <Procedure Pointer> must be assigned to the value of <Pointer> in the procedure by Transfer.
Note: The parameters of this procedure are optional: you can for example only specify the path of the file to copy and the path of the destination file.

Procedure that is using each copied file (syntax 2 only)

For each file found, fCopyFile automatically calls the <Procedure Name> procedure. This procedure is a local or global procedure.
To create this procedure:
  1. Create a global procedure (from the code editor: on the "Code" pane, in the "Procedures" group, expand "New" and select "New global procedure").
  2. Fill the procedure declaration as follows:
PROCEDURE <Procedure Name> (<Path of File to Copy>, <Path of Destination File>,
[ <Change>, [<Procedure Pointer>]])
  • <Path of File to Copy> is the path of the file to copy.
  • <Path of Destination File> is a character string containing the name of the destination file.
  • <Change> is an optional constant that is set to:
    • flFirstFile when the file is the first file copied into the <Source File> directory.
    • flChangeDir when the file is the first file listed in a sub-directory of <Path of Directory to Copy> (which means that a change of directory occurred).
    • flFile in all the other cases.
      The different values that can be taken by <Change> are as follows:
      Current file<Change>
      Dir\File 1flFirstFile
      Dir\File nflFile
      Dir\SubDir 1\File 1flChangeDir
      Dir\SubDir 1\File mflFile
      Dir\SubDir 2\File 1flChangeDir
      Dir\SubDir 2\File xflFile
  • <Procedure Pointer> is an optional integer whose value is the one passed to the <Pointer> parameter of fCopyFile. If <Pointer> is not specified, <Pointer> is set to 0.
To retrieve the value of <Procedure Pointer>, the value of <Procedure Pointer> must be assigned to the value of <Pointer> in the procedure by Transfer.
Note: The parameters of this procedure are optional: you can for example only specify the path of the file to copy and the path of the destination file.
Versions 19 and later

Values returned by the procedure (Syntax 2)

The <Procedure Name> procedure must return one of the following values:
fcStopUsed to stop the copy permanently.
fcCopyUsed to continue the copy.
fcIgnoreUsed to ignore the copy of a file.
A WLanguage error occurs if the procedure does not return one of these values.
Case 1. Full interruption of copy
To force the interruption of the copy, the <Procedure Name> procedure must return the fcStop constant.
Example: the "CopyProduct" procedure is automatically called by fCopyFile:
PROCÉDURE CopyProduct(PathSourceFile, PathDestinationFile)
...
// Stop requested?
Multitask(-1)
IF KeyPressed(kpEscape) = True THEN
Info("The copy will be stopped")
RESULT fcStop
END
...
RESULT fcCopy
If the ESC key is pressed, fCopyFile returns the fcStop constant.
In the other cases (to continue the browse), the <Procedure Name> procedure returns the fcCopy constant.
Case 2. Partial interruption of copy
In order for the <Procedure Name> procedure not to be run for a given file, the <Procedure Name> procedure must return the fcIgnore constant.
Example: The "FindProduct" procedure is automatically called by fCopyFile:
PROCÉDURE FindProduct(PathSourceFile, PathDestinationFile)
...
// File to ignore
IF StringEndsWith(PathSourceFile, "WrongFile.XLS") THEN
RESULT fcIgnore
END
...
RESULT fcCopy
To avoid copying the "WrongFile.XLS" file, the procedure returns the fcIgnore constant. The <Procedure Name> procedure is automatically called for the next copied file while the current file was not copied.
New in version 19

Values returned by the procedure (Syntax 2)

The <Procedure Name> procedure must return one of the following values:
fcStopUsed to stop the copy permanently.
fcCopyUsed to continue the copy.
fcIgnoreUsed to ignore the copy of a file.
A WLanguage error occurs if the procedure does not return one of these values.
Case 1. Full interruption of copy
To force the interruption of the copy, the <Procedure Name> procedure must return the fcStop constant.
Example: the "CopyProduct" procedure is automatically called by fCopyFile:
PROCÉDURE CopyProduct(PathSourceFile, PathDestinationFile)
...
// Stop requested?
Multitask(-1)
IF KeyPressed(kpEscape) = True THEN
Info("The copy will be stopped")
RESULT fcStop
END
...
RESULT fcCopy
If the ESC key is pressed, fCopyFile returns the fcStop constant.
In the other cases (to continue the browse), the <Procedure Name> procedure returns the fcCopy constant.
Case 2. Partial interruption of copy
In order for the <Procedure Name> procedure not to be run for a given file, the <Procedure Name> procedure must return the fcIgnore constant.
Example: The "FindProduct" procedure is automatically called by fCopyFile:
PROCÉDURE FindProduct(PathSourceFile, PathDestinationFile)
...
// File to ignore
IF StringEndsWith(PathSourceFile, "WrongFile.XLS") THEN
RESULT fcIgnore
END
...
RESULT fcCopy
To avoid copying the "WrongFile.XLS" file, the procedure returns the fcIgnore constant. The <Procedure Name> procedure is automatically called for the next copied file while the current file was not copied.

Values returned by the procedure (Syntax 2)

The <Procedure Name> procedure must return one of the following values:
fcStopUsed to stop the copy permanently.
fcCopyUsed to continue the copy.
fcIgnoreUsed to ignore the copy of a file.
A WLanguage error occurs if the procedure does not return one of these values.
Case 1. Full interruption of copy
To force the interruption of the copy, the <Procedure Name> procedure must return the fcStop constant.
Example: the "CopyProduct" procedure is automatically called by fCopyFile:
PROCÉDURE CopyProduct(PathSourceFile, PathDestinationFile)
...
// Stop requested?
Multitask(-1)
IF KeyPressed(kpEscape) = True THEN
Info("The copy will be stopped")
RESULT fcStop
END
...
RESULT fcCopy
If the ESC key is pressed, fCopyFile returns the fcStop constant.
In the other cases (to continue the browse), the <Procedure Name> procedure returns the fcCopy constant.
Case 2. Partial interruption of copy
In order for the <Procedure Name> procedure not to be run for a given file, the <Procedure Name> procedure must return the fcIgnore constant.
Example: The "FindProduct" procedure is automatically called by fCopyFile:
PROCÉDURE FindProduct(PathSourceFile, PathDestinationFile)
...
// File to ignore
IF StringEndsWith(PathSourceFile, "WrongFile.XLS") THEN
RESULT fcIgnore
END
...
RESULT fcCopy
To avoid copying the "WrongFile.XLS" file, the procedure returns the fcIgnore constant. The <Procedure Name> procedure is automatically called for the next copied file while the current file was not copied.

Managing errors

fCopyFile generates an error in the following cases:
  • the file to copy does not exist,
  • the file to copy is locked,
  • is invalid,
  • <Path of Copied File> is an empty string,
  • <Path of File to Copy> and <Path of Copied File> are identical.
WINDEVReports and QueriesUser code (UMC)

Operating mode in Windows Vista (and later)

If this function does not operate properly in Windows Vista (and later), check whether the file used is not found in one of the system directories (Windows directory or "Program Files" directory).
Indeed, in Windows Vista (and later), with the UAC mechanism (User Account Control) enabled, you must have the administrator privileges to handle and/or modify the files found in the system directories (Windows directory or "Program Files" directory).
Programming tip: To handle and/or modify the files without having administrator privileges, you should:
  • avoid writing into the Windows directory or into the "Program Files" directory,
  • use the system directory corresponding to the application (returned by SysDir associated with the srCommonAppData constant).

Creating directories during the copy

  • If one of the directories of the destination path does not exist, it is automatically created.
  • WINDEVWEBDEV - Server codeReports and QueriesAndroidAndroid Widget iPhone/iPadUniversal Windows 10 AppJavaAjaxUser code (UMC) If the source file corresponds to all the files found in a directory (for example, C:\Temp\*.*), the frRecursive constant must be used to create the sub-directories in the destination (and to copy their content).
Note: To copy directories, you also have the ability to use fCopyDir.
Windows Mobile

Equivalence

The operating mode of fCopyFile is equivalent to the operating mode of ceCopyFile.
The only difference is:
  • fCopyFile handles the files found on the Pocket PC from a WINDEV Mobile application.
  • ceCopyFile handles the files found on the Pocket PC from a WINDEV application.
Related Examples:
Handling text files Unit examples (WINDEV): Handling text files
[ + ] Handling "text" files with WINDEV:
- Create a text file
- Write into a text file
- Read in a text file
Handling text files Unit examples (WEBDEV): Handling text files
[ + ] This example explains how to handle "non HFSQL" files with WEBDEV and it allows you to:
- Create a text file
- Write into a text file
- Read in a text file
Handling text files Unit examples (WINDEV Mobile): Handling text files
[ + ] Handling external "text" files:
- Create a text file
- Write into a text file
- Read in a text file
Components
WINDEVWEBDEV - Server codeReports and Queries wd230std.dll
Windows Mobile wp230std.dll
Java wd230java.jar
Linux wd230std.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
EXEMPLO COPIAR ARQUIVO
https://youtu.be/qws0RUJ0Eqs

http://windevdesenvolvimento.blogspot.com.br/2018/05/dicas-1745-privada-windev-arquivos-29.html

https://groups.google.com/d/forum/amarildowindev

// EXEMPLO


// COPIAR ARQUIVO

// http://doc.windev.com/en-US/?3036004&name=fcopyfile_function

Resultado is boolean = fCopyFile("C:\amarildo\ipi.txt", EDT_DIRETORIO+"ipi.txt")

De matos
May 29 2018
Copiar Arquivo
Copiar Arquivo

Nessa aula vou mostrar como copiar um arquivo
This lesson will show you how to copy a file
Cette leçon va vous montrer comment copier un fichier

n_resultado is int=fCopyFile("D:\amarildo\Copia\copiaarquivo.txt","D:\amarildo\Copia\novoarquivo.txt")


n_resultado_F est entier=fCopieFichier("D:\amarildo\Copia\copiaarquivo.txt","D:\amarildo\Copia\novoarquivo.txt")

//Blog com Video e exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/08/curso-windev-arquivos-008-arquivos.html
https://www.youtube.com/watch?v=Q05zcTyXV1c
De matos AMARILDO
Sep. 01 2016