Just use the WinApi function SetFileAttributes; However, be careful to get the current attributes first, so that you can preserve any attributes you're not changing!
* Example use:
* If EXE is already Hidden, make it read only, but not System: IF 'H' $ GetFileAttr( 'C:\MyDir\MyApp.exe' ) * Make EXE read only: SetFileAttr( 'C:\MyDir\MyApp.exe', 'Rs' ) ENDIF
PROCEDURE SetFileAttr( pcFile, pcAttr ) * Author: William GC Steinford 2003 * Takes a file and a list of attributes to change on the file, and does the change * * pcFile : either just the file name or the full path to the file. * Either way, the full path will be resolved using FULLPATH() * pcAttrs : a list of attributes to change on the file * if the attribute character is Uppercase it will be turned on, * Lowercase, it will be turned off, * Not listed, it will be left alone. * a,A - Archive * s,S - System * h,H - Hidden * r,R - Read Only * i,I - Not Content-Indexed * t,T - Temporary Storage (try to keep in memory) * N - Normal (clear all other attributes)
*!* BOOL SetFileAttributes( *!* LPCTSTR lpFileName, // file name *!* DWORD dwFileAttributes // attributes *!* ) *!* DWORD GetFileAttributes( *!* LPCTSTR lpFileName // name of file or directory *!* )