How to change file attributes programmatically
There're many ways to change file attributes. It can be done through Windows Explorer, DOS ATTRIB comand, third party utilites, e.t.c. Also it can be done programmatically using Windows Scripting Host (WSH) or/and Windows API.
UDF below generates 128-bit GUID and returns it as a string in the format 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'.MSDN:
Creating directory preserving name case
- CreateDirectory function - Creates a new directory one level at a time
- SHCreateDirectory function - Creates a new directory including all intermediate folders, if necessary
- CreateFolder Method - WSH
- NewFolder Method - Shell
Windows Service Status
Returning UNC Path associated with a local device
Opening URL in default Web Browser
Launching Windows Explorer for Specified Drive, Folder or File
File date and time
Code below shows how to retrieve file date and time using native VFP commands or WSH. For Windows API based solution that also allows to set file date and time, see George Tasker's Windows Time hosted on UTMSDN links:
Creating System Environment Variables
Copy, Move, Rename File Preserving Destination Name Case
The CopyFile() and MoveFile() WIN API functions preserve the case of the name for the destination file. Alternatively, WSH can be used.
The source and destination file names should include the directory name in both cases.
Note 1 A Copy operation will not change file name case when destination file already exists (overwritten).
Note 2 The WinApiErrMsg is used to retrieve Windows API error message in case of error.