Results 1 to 8 of 8

VBA Find Latest Folder then largest file.

Threaded View

WAW VBA Find Latest Folder then... 11-24-2010, 06:52 AM
WAW Re: VBA Find Latest Folder... 11-24-2010, 08:30 AM
WAW Re: VBA Find Latest Folder... 11-30-2010, 09:56 AM
watersev Re: VBA Find Latest Folder... 11-30-2010, 10:34 AM
snb Re: VBA Find Latest Folder... 11-30-2010, 11:45 AM
WAW Re: VBA Find Latest Folder... 11-30-2010, 12:53 PM
snb Re: VBA Find Latest Folder... 11-30-2010, 01:00 PM
watersev Re: VBA Find Latest Folder... 11-30-2010, 01:36 PM
  1. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: VBA Find Latest Folder then largest file.

    The largest file in the most recent folder:

    Sub largest_file_in_most_recent_folder()
      c00 = "E:\OF\"
      c01 = "E:\text.txt"
        
      For j = 1 To 2
        If Dir(c01) <> "" Then Kill c01
        Open c01 For Output as #1
        Close #
    
        Shell "cmd Dir " & c00 & Choose(j, "*.", "*.??*") & Choose(j, " /b /o-d > ", " /b /o-s > ")  & c01
    
        Do
          DoEvents
        Loop Until FileLen(c01) > 0
            
        Open c01 For Input As #1
          c00 = c00 & Split(input(LOF(1), #1), vbCrLf)(0) & IIf(j = 1, "\", "")
        Close #1
      Next
    End Sub
    Last edited by snb; 11-30-2010 at 12:58 PM.



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1