Dim arrHeaders(40)
Dim strNamePrefix, strPicturesDir, strTripName, strFolderName, strModifiedDate
Dim strNewName



sub ConvertPictures(intTimeChange)

sFolderPathspec = strPicturesDir + "\" + strTripName + "\" + strFolderName

msgbox sfolderpathspec

Set objShell = CreateObject ("Shell.Application")
Set objFolder = objShell.Namespace(sFolderPathspec)


'Echo all properties available
'For i = 0 to 40
'  arrHeaders(i) = i & " " & objFolder.GetDetailsOf(objFolder.Items, i) 
'Next 
'wsh.echo join(arrHeaders, vbNewline)


msgbox "Ready To Convert: " + strFolderName + vbNewLine + vbNewLine + "Press OK to start ..."

' Echo name and date taken for only jpg, avi, and mov files
intPicNumber = 0
For Each strFileName In objFolder.Items
    strFileExtension = right(strFileName,3)
    if lcase(strFileExtension) = "jpg" or lcase(strFileExtension) = "avi" or lcase(strFileExtension) = "mov" then
      intPicNumber = intPicNumber + 1
      dtDateTimeModified = objFolder.GetDetailsOf(strFileName, 3)

      dtNEWDateOfPicture = dateadd("h",intTimeChange,dtDateTimeModified ) 
      strFileName.ModifyDate = dtNEWDateOfPicture 
      dtDateTimeModified  = dtNEWDateOfPicture 

      intYear = year(dtDateTimeModified)
      intMonth = month(dtDateTimeModified)
      intDay = day(dtDateTimeModified)
      intHour = hour(dtDateTimeModified)
      intMin = minute(dtDateTimeModified)
      
      strYear = cstr(intYear) 
      
      if intMonth < 10 then 
        strMonth = "0" + cstr(intMonth) 
      else 
        strMonth = cstr(intMonth)
      end if
      
      if intDay < 10 then 
        strDay = "0" + cstr(intDay) 
      else 
        strDay = cstr(intDay)
      end if
      
      if intHour < 10 then 
        strHour = "0" + cstr(intHour) 
      else 
        strHour = cstr(intHour)
      end if
      
      if intMin < 10 then 
        strMin = "0" + cstr(intMin) 
      else 
        strMin = cstr(intMin)
      end if
      
      if intPicNumber < 100 then strPicNum = "0" else strPicNum = ""
      if intPicNumber < 10 then strPicNum = strPicNum + "0"
      strPicNum = strPicNum + cstr(intPicNumber)
      

    strNewName = strTripName + "-" + right(strFolderName,len(strFolderName) - 9)
    strNewName = strNewName + "-" + strYear + "" + strMonth + "" + strDay 
    strNewName = strNewName + "-" + strHour + strMin 
    strNewName = strNewName + "-" + strPicNum
    strNewName = strNewName + "." + strFileExtension
'    msgbox strNewName

    strFileName.name = strNewName
    
    end if

Next

'msgbox "Finished Converting " + strFolderName + vbNewLine + vbNewLine + "Press OK for next Directory ..."


end sub


strPicturesDir = "C:\Users\Admin\Desktop"
strTripName = "200907OutWestTrip"

strFolderName = "20090623-BeforeLeaving"
call ConvertPictures(0)

strFolderName = "20090624-TravelAndLamberts"
call ConvertPictures(0)

strFolderName = "20090625-TravelAndBigTexan"
call ConvertPictures(0)

strFolderName = "20090626-4CornersAndCanyonDeChelly"
call ConvertPictures(0)

strFolderName = "20090628-PaintedDesertAndPetrifiedForest"
call ConvertPictures(0)

strFolderName = "20090629-GrandCanyon"
call ConvertPictures(0)

strFolderName = "20090630-LasVegasAndHooverDam"
call ConvertPictures(0)

strFolderName = "20090702-ZionAndBryceCanyon"
call ConvertPictures(0)

strFolderName = "20090706-LavaHotSpringsID"
call ConvertPictures(0)

strFolderName = "20090707-Yellowstone"
call ConvertPictures(0)

strFolderName = "20090711-MountRushmoreAndHillCity"
call ConvertPictures(0)

strFolderName = "20090714-WallDrugToSiouxFallsSD"
call ConvertPictures(0)

strFolderName = "20090715-MadisonWisconsin"
call ConvertPictures(0)

strFolderName = "20090717-TravelHome"
call ConvertPictures(0)


msgbox "Complete"
