Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Safe directory delete
Message
 
 
To
04/01/2009 06:12:05
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01370874
Message ID:
01370877
Views:
11
>Hi all
>
>Help please,
>
>I get The data path in the project start.
>oApp.startdir=network\data\..
>set defa to (oApp.startdir)..
>
>Now I want to delete entire files of temp directory (only files, not directory) on local computer.
>
>I use with the following code:
>
local nloop,cfilename,cOutput
>Local array aFiles(1)
>cOutput='c:\tmpfox\'
>set default to (cOutput)
>nFiles=adir(aFiles)
>If nFiles>0
>	for nLoop=1 to nFiles
>		cFilename=cOutput+aFiles[nLoop,1]
>		delete file (cFilename)
>	endfor
>Endif
>set default to (oApp.startdir)
>return .t.
>I afraid about any unexpected problem that will cause the 'set defa to local' to fail and the user will delete thr real data.
>Thank's

You can provide path in adir, e.g.
lnFiles = adir(laFiles, cOutput + ".*")

also do it in try/catch block in case some file is used.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform