'---- Picasa sorted export script 
Option Explicit 
'Stuff you might want to adjust: 
Dim InputFile, SourceFolder, TargetFolder, Padding 
InputFile = "index.xml" 
SourceFolder = "images\" 
TargetFolder = "ImagesSorted\" 
Padding = 3  'Padding = 3 --> 001-foo.jpg 
Dim Script, FileSystem 
Set Script = WScript.CreateObject("WScript.Shell") 
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject") 
Dim InStream 
If FileSystem.FileExists(InputFile) Then 
 If FileSystem.FolderExists(TargetFolder) Then 
Wscript.Echo "Target folder exists. Rename folder and restart." 
  Call CleanUp(1) 
 Else 
  FileSystem.CreateFolder TargetFolder 
  Set InStream = FileSystem.OpenTextFile(InputFile, 1) 
  Call ProcessFile() 
 End If 
Else 
 Wscript.Echo "Input file not found. (" + InputFile + ")" 
End If 
Call CleanUp(0) 
Sub CleanUp(exitCode) 
Set InStream = Nothing 
Set Script = Nothing 
WScript.Quit(exitCode) 
End Sub 
Function ProcessFile() 
Dim nLine, sLineNew, sLineOld, nCount, Part 
Dim GoodPart, CurImage, NewName 
nCount = 0 
Do Until InStream.AtEndOfStream 
 sLineNew = InStream.ReadLine 
 Part = Mid(sLineNew,2,17) 
 If Part = "</itemLargeImage>" Then 
  GoodPart = Mid(StrReverse(Mid(StrReverse(sLineOld),1)),10)
  Set CurImage = FileSystem.GetFile("images\" + GoodPart) 
  NewName = TargetFolder + Pad(nCount,Padding,0) + "-" + GoodPart 
  CurImage.Copy NewName 
  nCount = nCount + 1 
End If 
sLineOld = sLineNew 
Loop 
End Function 
Function Pad(Value, Width, Char) 
Pad = Right(String(Width, CStr(Char)) & CStr(Value), Width) 
End Function 