* WSH #define WindowsFolder 0 #define SystemFolder 1 #define TemporaryFolder 2 oFs = createobject('Scripting.FileSystemObject') oTempFolder = oFs.GetSpecialFolder(TemporaryFolder) ? 'WSH :',oTempFolder.Path * WinAPI declare integer GetTempPath in win32API ; integer nBufferLength, string @ lpBuffer lpBuffer = space(1024) && Max 261 if not w2000 or later like XP-wouldn't harm lnLength = GetTempPath(1024, @lpBuffer) if lnLength #0 ? 'WinAPI :'+left(lpBuffer,lnLength) endif * VFP do case case !empty(getenv('TMP')) and directory(getenv('TMP')) ? 'VFP:',getenv('TMP') case !empty(getenv('TEMP')) and directory(getenv('TEMP')) ? 'VFP:',getenv('TEMP') otherwise ? 'VFP self:',sys(2023) && Fox temp path endcaseCetin
>>lcPath = 'c:\temp\' >>lcSkeleton = '*.tmp' >>declare integer SetFileAttributes in Win32API ; >> string @ lpFileName, integer dwFileAttributes >>declare short DeleteFile in win32API string @ lpFileName >>lnFiles=adir(arrFiles,lcPath+lcSkeleton,'HS') >>for ix=1 to lnFiles >> SetFileAttributes(lcPath+arrFiles[ix,1], 0) >> DeleteFile(lcPath+arrFiles[ix,1]) >>endforCetin