realbasic-nug
[Top] [All Lists]

Re: Help please: Why aren't these files deleted?

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Help please: Why aren't these files deleted?
From: Lennox Jacob <lenpartico at yahoo dot com>
Date: Fri, 29 Feb 2008 14:44:36 -0800 (PST)
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Thanks Joe and Chris,
That was the problem
I prefer Joe's suggestion to combine the two lines

S = File.OpenAsTextFile.ReadAll
Thanks again.

Lennox.

Joe Strout <joe at inspiringapps dot com> wrote: On Feb 29, 2008, at 7:41 AM, 
Lennox Jacob wrote:

>         TIS = File.OpenAsTextFile
>         S = TIS.ReadAll  // Open the file and start reading and  
> input the lines as the come
>         if Trim(S) = "" or Trim(S) = chr(13) then
>           msgbox File.Name + " deleted"
>           File.delete

The Delete call here fails because you still have the file open (via  
TIS).  Add "TIS = nil" after the TIS.ReadAll, and it should work.   
(Or, just combine the two lines to S = File.OpenAsTextFile.ReadAll...  
and either way, you should be prepared to catch an exception if the  
file can't be opened.)

Best,
- Joe

--
Joe Strout
Inspiring Applications, Inc.
http://www.InspiringApps.com



_______________________________________________
Unsubscribe or switch delivery mode:


Search the archives:



       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>