realbasic-nug
[Top] [All Lists]

Help please: Why aren't these files deleted?

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Help please: Why aren't these files deleted?
From: Lennox Jacob <lenpartico at yahoo dot com>
Date: Fri, 29 Feb 2008 06:41:57 -0800 (PST)
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Hello,

I have the following code in a pushbutton. When the pushbutton is pushed (the 
name of the folder is in EditField1), the files to be deleted comes up in the 
message box and the total number of files deleted also comes up, but the files 
are not actually deleted.

  Dim TIS as TextInputStream
  Dim TOS as TextOutputStream
  dim f, File As FolderItem
  dim i,j As Integer
  dim S As string
  Dim DeletingFilesFolderName as string = EditField1.Text
  f=DocumentsFolder.child(DeletingFilesFolderName)
  j=0
  for i=1 to f.Count 'Every file in the folder
    
    File=f.trueItem(i)
    if File<>nil then
      If File.name.left(3) = "200" then
        
        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
          j=J+1
        end if
        
      end if
      
    end if
  next
  msgbox str(j) + " files deleted from folder " + DeletingFilesFolderName

Why aren't these files deleted?

Thanks.

Lennox



       
---------------------------------
Looking for last minute shopping deals?  Find them fast with Yahoo! Search.
_______________________________________________
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>