Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deleting folders?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00638521
Message ID:
00639102
Views:
24
>>>>Yeah, that´s right... I´m triying to kill IE Temp files... ok, thanks for help an time guys...
>>>
>>>It's fairly easy to iterate through the folders files collection, and use the file's delete method. You could, of course, use ADIR() to do the same thing.
>>
>>This is actually a job for SHFileOperation - it can delete file content, recursively if desired, and can be set to continue executing a delete operation even if it is prevented from completing referenced files; it returns a bit indicating that specific requests were refused, and it's possible to retrieve a list of the items that failed to do as told. Implementing this for myself took a fair amount of tedious coding, but it is doable using only native VFP code and some API calls. - set up SHFileOperation to perform the delete as desired - you can specify multiple templates for the deletion, prevent Windows from requesting confirmation of deletions, allow or disallow recursion, disable the error UI and a few other tricks - check SHLOBJ.H and SHELLAPI.H for the flags and functions.
>
>Ed,
>
>You know, some people don’t like to or shouldn’t be allowed to play with sharp objects because they might hurt themselves. In Windows, this means pointers < vbg >. What about getting an object reference to the bit bucket via the Shell.Application’s NameSpace method, and simply moving the files there with the MoveHere method? Or am I missing something?


I've honestly never tried it, since I already have a snazzy wrapper that I rely on to do the tedious setup for the API call through a parameter object - populate the parm object's pFrom and (if necessary) pTo member arrays, the Operation property tells what basic operation is going to be done, and other properties set the optional behavior flags. It either returns a null for success or a member array indicating the files which failed to comply with the request. Admittedly, writing the wrapper class took some time and effort; OTOH, it's now at the point where it's pretty much dead-bang easy to use - create the object, populate the file list(s)set a few flags and let it rip - the codemonkey never has to peer at what goes on under the covers.

Philosophically, since these are temp files being cleared out, there's no need to let the selected passengers stop over and accumulate in the Recycle Bin lounge - just shove them out the door at 40,000 feet without a parachute....

And I think the FSO's DeleteFolder works recursively under some operating sustems, too - I know that at least with the Win9x systems, you can delete a non-empty folder.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform