ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions
  • Moving a directory and its content
  • 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
Moves the content of a directory into another directory.
// Move the content of a directory
// The content of the "C:\Directories\MyFiles" directory is moved
// into the "D:\Documents\FileCopy" directory
Res is boolean
Res = fMoveDir("C:\Directories\MyFiles", "D:\Documents\FileCopy", frRecursive)
IF Res = False THEN
Error(ErrorInfo(errMessage))
END
Syntax
<Result> = fMoveDir(<Path of directory to move> , <Path of destination directory> [, <Move indicator>])
<Result>: Boolean
  • True if the content of the directory was moved,
  • False otherwise. To get more details on the error, use ErrorInfo with the errMessage constant.
<Path of directory to move>: Character string
Name and full (or relative) path of the directory whose content must be moved (up to 260 characters). A UNC path can be used. The wildcard characters (*,?) are allowed. This directory name may (or may not) end with "\".
WindowsLinux This parameter can be in Ansi or Unicode format.
<Path of destination directory>: Character string
Name and full (or relative) path of the destination directory (up to 260 characters). A UNC path can be used. This directory name may (or may not) end with "\".
WindowsLinux This parameter can be in Ansi or Unicode format.
<Move indicator>: Optional constant (or combination of constants)
The following constants can be used (no option is selected by default):
frConfirmThe content of the directory is moved once the overwriting of the directory with the same name is confirmed.
WEBDEV - Server code This constant is not available.
frProgressA progress window is displayed.
WEBDEV - Server code This constant is not available.
frRecursiveThe content of the source directory is moved (files and sub-directories). If the source directory contains some files or sub-directories and if this constants is not specified, the copy is not performed.
<Move indicator> is empty by default. None of these options is selected.
Remarks

Moving a directory and its content

To move the content of the directory, only the path and the name of the directory to move must be specified. For example, the line of code:
fMoveDir("C:\MyDirectories\MyFiles", "D:\MyDocuments\FileCopy", frRecursive)
  • Copies the files found in "C:\MyDirectories\MyFiles" into "D:\MyDocuments\FileCopy". The source directory is not re-created.
  • The initial directory and its content are destroyed.
To move the directory and its content, we recommend that you use fRename.
WINDEVWEBDEV - Server codeReports 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 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.
Component: wd290std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 08/23/2022

Send a report | Local help