Results 1 to 3 of 3

Thread: I need the most recent folder on a drive

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jul 2002
    Posts
    80

    I need the most recent folder on a drive

    I have a drive that have the following folders.

    Jan02
    Feb02
    .
    .
    .
    Aug02

    A new folder is created manually each month i.e. in October I will create a Sep02 folder. What I need to do is grab the folder name of the last folder created. I know how to use the dir$ command but I don't know how I can tell if the folder name is the most recent one created. Does anyone have any ideas how I can do this?

    Thanks,

    James

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    using the filesystemobject you can do something like
    VB Code:
    1. Dim FileSys As New FileSystemObject
    2.     Dim objFolder As Folder
    3.     Set objFolder = FileSys.GetFolder("PathHere")
    4.     MsgBox "CREATED " & objFolder.DateCreated
    5.     MsgBox "ACCESSED " & objFolder.DateLastAccessed
    6.     MsgBox "MODIFIED " & objFolder.DateLastModified
    7.     Set objFolder = Nothing
    8.     Set FileSys = Nothing

  3. #3
    Addicted Member kidlaley's Avatar
    Join Date
    Jun 2002
    Location
    California
    Posts
    159

    i will say you used...

    file system object to get the files attributes or date and time

    but maybe i'm wrong
    There's only Three kinds of people in this world.....
    Those that know how to count, and those that do not......
    ]

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