How to create a folder with mm/dd/yyyy/hh/mm

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anoble1
    New Member
    • Jul 2008
    • 246

    How to create a folder with mm/dd/yyyy/hh/mm

    I currently have a database backup button in my database. It grabs the database where it currently is, and makes a copy of it, then makes a new folder with the Month day year. Well, I do multiple updates daily (and space is not an issue). So, question is, can you have access make and name a new folder with hours and minutes?

    Code:
    'Customer Issues BACKUP
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    
    Rootpath = "S:\Workgroups\APC Power Delivery-Contract Services\Student Engineer\Customer Issues\Customer Issues BACKUPS\" & Month(Date) & "-" & Day(Date) & "-" & Year(Date) & "\"
    
    If Not (fso.FolderExists(Rootpath)) Then fso.CreateFolder (Rootpath)
    
    Shell "xcopy " & """" & Rootpath & """" & " " & """" & Rootpath & """" & " /e /y"
    Shell "xcopy " & """" & "S:\Workgroups\APC Power Delivery-Contract Services\Customer Issues\Customer Issues.mdb" & """" & " " & """" & Rootpath & """" & "/y"
    
    Exit Sub
    End Sub
  • beacon
    Contributor
    • Aug 2007
    • 579

    #2
    You can use hours and minutes by using the Time function, but you'll have to convert the time to a string and remove the semi-colon.

    Personally, I would convert it to military time and use that in the file name.

    Comment

    Working...