ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions
  • Operating mode in Windows Vista (and later)
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Copies the contents of a directory and its subdirectories.
// Copy a directory
Res = fCopyDir("C:\Directory\MyFiles", "D:\Documents\FileCopy", ...
frConfirm + frProgress + frRecursive)
// Copy a directory
Res = fCopyDir("C:\Directory\MyFiles", "D:\Documents\FileCopy", FilterFile)
PROCEDURE FilterFile(sSourcePath, sDestinationPath, flChange, nCustomParameter)
 
// Don't copy the temporary files
IF fExtractPath(sSourcePath, fExtension) ~= ".tmp"
RESULT fcIgnore
ELSE
RESULT fcCopy
END
Syntax

Copying a directory Hide the details

<Result> = fCopyDir(<Path of directory to copy> , <Path of destination directory> [, <Copy indicator>])
<Result>: Boolean
  • True if the image was copied,
  • False otherwise. To get more details on the error, use ErrorInfo with the errMessage constant.
<Path of directory to copy>: Character string
Name and full (or relative) path of directory to copy (up to 260 characters). A UNC path can be used. Wildcard characters (*,?) are allowed in the file name. This directory name may (or may not) end with "\".
Windows This parameter can be in Ansi or Unicode format.
<Path of destination directory>: Character string
Name and full (or relative) path of copied directory (up to 260 characters). A UNC path can be used. This directory name may (or may not) end with "\".
This directory is automatically created if it does not exist.
Windows This parameter can be in Ansi or Unicode format.
<Copy indicator>: Optional constant (or combination of constants)
Type of copy:
frConfirmCopy a directory and ask for confirmation before overwriting a directory with the same name.
frProgressA progress window is displayed.
frRecursiveSubdirectories are processed.

<Copy indicator> is empty by default. None of these options is selected.

Copying a directory by handling each copied file Hide the details

<Result> = fCopyDir(<Path of directory to copy> , <Path of destination directory> , <WLanguage procedure> [, <Pointer> [, <Copy indicator>]])
<Result>: Boolean
  • True if the image was copied,
  • False otherwise. To get more details on the error, use ErrorInfo with the errMessage constant.
<Path of directory to copy>: Character string
Name and full (or relative) path of directory to copy (up to 260 characters). A UNC path can be used. Wildcard characters (*,?) are allowed in the file name. This directory name may (or may not) end with "\".
Windows This parameter can be in Ansi or Unicode format.
<Path of destination directory>: Character string
Name and full (or relative) path of copied directory (up to 260 characters). A UNC path can be used. This directory name may (or may not) end with "\".
This directory is automatically created if it does not exist.
Windows This parameter can be in Ansi or Unicode format.
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure ("callback") called for each file copied. This procedure is used to handle the current file.
For more details on this procedure, see Parameters of the procedure used by fCopyDir.
<Pointer>: Optional integer
Pointer passed to <WLanguage procedure>.
<Copy indicator>: Optional constant
Type of copy:
frRecursiveSubdirectories are processed.

<Copy indicator> is empty by default: the process is not recursive.
Remarks
Reports and Queries

Operating mode in Windows Vista (and later)

If this function does not operate properly in Windows Vista (and later), check whether the file or directory used is not in one of the system directories (Windows directory or "Program Files" directory).
In Windows Vista (and later), with the UAC mechanism (User Account Control) enabled, you must have administrator privileges to handle and/or modify the files or directories in system directories (Windows directory or "Program Files" directory).
Programming tip: To handle and/or modify the files or directories without administrator privileges, you should:
  • avoid writing to the Windows directory or to the "Program Files" directory,
  • use the system directory of the application (returned by SysDir with the srAppDataCommun constant, for example).
Remark: In Windows Vista (and later), the virtualization mechanism is used to make the applications compatible with Vista. If the file is created in a system directory without having sufficient rights, this file will actually be created in another directory (C:\Users\<LOGIN>AppData\Local\VirtualStore\Windows\). In this case, the file cannot be shared between several applications.
Business / UI classification: Business Logic
Component: wd290std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/07/2023

Send a report | Local help