Results 1 to 7 of 7

Thread: [RESOLVED] Deleting files older than x [Resolved]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Resolved [RESOLVED] Deleting files older than x [Resolved]

    I have the following code:
    VB Code:
    1. Dim fs, f
    2.     Set fs = CreateObject("Scripting.FileSystemObject")
    3.    
    4.     For i = 0 To CInt(NUMFOLDERS)
    5.         While Dir(FARR(i) & "\*.BAK") <> ""
    6.             filespec = Dir(FARR(i) & "\*.BAK")
    7.             If filespec <> "" Then
    8.                 Set f = fs.GetFile(FARR(i) & "\" & filespec)
    9.                 mdate = f.DateLastModified
    10.                 If mdate < DateAdd("d", -14, Format(Now, "mm/dd/yyyy")) Then
    11.                     txtLog.Text = txtLog.Text & "delete: " & filespec & vbCrLf
    12.                 End If
    13.             End If
    14.         Wend
    15.     Next

    I'm just dumping the output to at textbox at the moment for testing, but the problem is that it never moves to the next file... it keeps running the same file in the while loop. Why doesn't it move to the next one?
    Last edited by ober0330; Aug 29th, 2005 at 09:09 AM.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width