Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deleted temp files...
Message
From
06/02/2002 12:38:53
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00616127
Message ID:
00616158
Views:
23
This message has been marked as a message which has helped to the initial question of the thread.
* 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
endcase 
Cetin
>Do you know a way to get the temp directory from the OS?
>
>>>I am printing 500 .PDF files to a printer with adobe. It created many hidden temp files on windows\temp directory.
>>>
>>>The problem is that the files are not erased from the drive after the print.
>>>
>>>Is there an API call that will clean up the temp directory that I can call?
>>
>>
>>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])
>>endfor
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform