Link to home
Start Free TrialLog in
Avatar of KMKeller
KMKeller

asked on

Append datestamp to all files in a directory

I need a script that will allow me to append the datestamp of each file in a directory to each filename.  For example;

Name                                                         Date Modified
test1.txt                                                      6/18/2013
Joeresume.doc                                            7/12/2013

Would become;

Name                                                         Date Modified
test1_20130618.txt                                                6/18/2013
Joeresume_20130712.doc                                      7/12/2013
Avatar of jmcmillan227
jmcmillan227

Function GetDateTimeStamp
  Dim strNow
  strNow = Now()
  GetDateTimeStamp = Year(strNow) & Pad2(Month(strNow)) _
        & Pad2(Day(StrNow)) & Pad2(Hour(strNow)) _
        & Pad2(Minute(strNow)) & Pad2(Second(strNow))
End Function

Function Pad2(strIn)
  Do While Len(strIn) < 2
    strIn = "0" & strIn
  Loop
  Pad2 = strIn
End Function
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial