I got this code as a reply to a previous thread. It's to take file names into an array and then compare the size of the old file to the size of the copied file in a diferent folder(The copying is done in another sub). I just can't seem to get it working. The files won't delete. Your help is greatlty appreciated.

Code:
'thanks to kedaman for the original code
Sub EnumDir(ByRef edir() As String, path As String)
Dim n As Integer, a As String
 a = Dir(path)
 Do While Len(a)
   ReDim Preserve edir(n)
   edir(n) = a
   n = n + 1
   a = Dir
  Loop
End Sub

Sub SizeChecking()
Dim olddir() As String, newdir() As String
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
Dim n As Integer, a As String
  EnumDir olddir(), "C:\TestOrator\Outgone\*.txt"
  EnumDir newdir(), MyNewDir
  For n = 0 To UBound(olddir)
    If FileLen(olddir(n)) = FileLen(newdir(n)) Then
      'files are the same size
      MsgBox "files are the same size"
      FSO.DeleteFile "C:\TestOrator\Outgone\*.txt"
      Else
      'files are not the same size
      MsgBox "The Files that were transferred were not the same size."
    End If
  Next n
End Sub
Thanks

[Edited by kanejone on 09-15-2000 at 10:28 AM]