home *** CD-ROM | disk | FTP | other *** search
/ Chip: 25 Years Anniversary / CHIP_25Jahre_Jubilaeum.iso / downloads / 401215 / umbenennenFotos.vbs
Text File  |  2003-09-09  |  1KB  |  56 lines

  1.  
  2. Option Explicit
  3.  
  4. Dim listArgs
  5. Dim objFileSystem, objFolder, objFile
  6. Dim szFolder, szDateCreated, szYear, szMonth, szDay
  7.  
  8. Set listArgs = WScript.Arguments
  9.  
  10. If listArgs.Count = 0 Then
  11.    szFolder = InputBox("Welcher Ordner?","Ordner auswΣhlen","C:\Daten\Alex\Fotos")
  12. Else
  13.    szFolder = listArgs(0)
  14. End If
  15.  
  16. Set objFileSystem = CreateObject("Scripting.FileSystemObject")
  17.  
  18. If objFileSystem.FolderExists(szFolder) Then
  19.  
  20.    Set objFolder = objFileSystem.GetFolder(szFolder)
  21.    
  22.    For Each objFile In objFolder.Files
  23.       If objFile.Type = "JPEG-Bild" Then
  24.          
  25.          szDateCreated = objFile.DateCreated
  26.          szYear = Year(szDateCreated)
  27.          szMonth = Month(szDateCreated)
  28.          szDay = Day(szDateCreated)
  29.          
  30.          If isDate(szDateCreated) Then
  31.             
  32.             szYear = Year(szDateCreated)
  33.             szMonth = Month(szDateCreated)
  34.             szDay = Day(szDateCreated)
  35.             
  36.             If szMonth < 10 Then
  37.                szMonth = "0" & szMonth
  38.             End If
  39.  
  40.             If szDay < 10 Then
  41.                szDay = "0" & szDay
  42.             End If
  43.             
  44.             szDateCreated = szYear & szMonth & szDay
  45.             
  46.             If szDateCreated <> left(objFile.Name, 8) Then
  47.                objFile.Name = szDateCreated & " " & objFile.Name
  48.             End If   
  49.             
  50.          End If
  51.       End If
  52.    Next 
  53.  
  54. Else
  55.    MsgBox "Angegebener Ordner existiert nicht!"
  56. End If