FUNCTION SetFileAttribs LPARAMETERS tcFileName, tcAttributeMask, tnAttributeBaseRef IF TYPE('tnAttributeBaseRef') # 'N' * No extended attributes mask suggested, so set no attributes for Base tnAttributeBaseRef = 0 ENDIF IF TYPE('tcAttributeMask') # 'C' * No attribute Mask sent - set no attributes, clear all set now tcAttributeMask = '' ELSE tcAttributeMask = UPPER(tcAttributeMask) ENDIF IF TYPE('tcFileName') # 'C' * Filename must be character RETURN .F. ENDIF LOCAL aFiles[1,5], nAttribs IF ADIR(aFiles,FULLPATH(tcFileName),'SHR') # 1 * File must exist and not be a wildcard reference RETURN .F. ENDIF IF 'D' $ aFiles[1,5] OR ; 'V' $ aFiles[1,5] * File must not be a directory or Volume label RETURN .F. ENDIF * R = Read-only 1 * H = Hidden 2 * S = System 4 * A = Archive 32 * * Any other attribute must be specified via the * tnAttributebaseRef parameter nAttribs = tnAttributeBaseRef + ; IIF('R' $ tcAttributeMask, 1, 0) + ; IIF('H' $ tcAttributeMask, 2, 0) + ; IIF('S' $ tcAttributeMask, 4, 0) + ; IIF('A' $ tcAttributeMask,32, 0) RETURN (SetFileAttributes(FULLPATH(tcFileName), nAttribs) = 1)