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: Joe Strout <joe at inspiringapps dot com>
Date: Fri, 29 Feb 2008 08:03:44 -0700
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <114788 dot 21527 dot qm at web65405 dot mail dot ac4 dot yahoo dot com>
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:
<http://www.realsoftware.com/support/listmanager/>

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


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