Thanks Joe,
It works - I had to change File to folderitem though.
This is what I did...
In the Pushbutton Action event I entered
Dim dir as folderitem
dir = DocumentsFolder.Child("My temp Files")
DeleteFiles (dir)
Then I created a method
Method Name DeleteFiles
Parameters dir as Folderitem
then the code ... as you suggested
for i As Integer = dir.Count DownTo 1
Dim f As File = dir.TrueItem(i)
if f.Directory then DeleteFiles f
f.Delete
next
but I had to change
Dim f As File = dir.TrueItem(i) to Dim f As folderitem = dir.TrueItem(i)
because I keep getting an error - there is no class with this name (File)
Why is that? Am I missing something?
Thanks again Joe.
Lennox.
[EMAIL PROTECTED] wrote: On Feb 25, 2007, at 02:01 UTC, Lennox Jacob wrote:
> Hello,
> I have a Folder that is named "My Temp Files".
> I also have a pushbutton named "Delete My Temp Files" How do I code
> the pushbutton to delete all files in "My Temp Files" folder? Thanks.
Well, I'm going to assume you can get a FolderItem to your My Temp
Files folder. Then pass it into a method that looks like this:
Sub DeleteFiles( dir as FolderItem )
for i As Integer = dir.Count DownTo 1
Dim f As File = dir.TrueItem(i)
if f.Directory then DeleteFiles f
f.Delete
next
End Sub
This is a recursive implementation, which is not always ideal, but it
sure is easy in cases like this. It's also light on error-checking...
but hey, it's just sample code; you can't expect us to write your whole
app for you. :)
Cheers,
- Joe
--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC "Making the Internet a Better Place"
http://www.verex.com/
_______________________________________________
Unsubscribe or switch delivery mode:
Search the archives:
---------------------------------
8:00? 8:25? 8:40? Find a flick in no time
with theYahoo! Search movie showtime shortcut.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>