Yesterday, a friend who was behind the times gave it to me. All the files and pictures of a website are put into the database in binary form. You can use the following code to restore the files and pictures in the database.
Change the obtained database name to ToMdb.mdb, and then save the following code into VBS format. Place it in the same directory and execute this VBS file
Dim rs, ws, fso, conn, stream, connStr, theFolder
Set rs = CreateObject("ADODB.RecordSet")
Set stream = CreateObject("ADODB.Stream")
Set conn = CreateObject("ADODB.Connection")
Set fso = CreateObject("Scripting.FileSystemObject")
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=ToMdb.mdb;"
conn.Open connStr
rs.Open "wz", conn, 1, 1
stream.Open
stream.Type = 1
On Error Resume Next
Do Until rs.Eof
thePath = rs("folder") & ""
theFolder = Left(thePath, InStrRev(thePath, ""))
If fso.FolderExists(theFolder) = False Then
createFolder(theFolder)
End If
stream.SetEos()
stream.Write rs("body")
stream.SaveToFile str & thepath & rs("file"), 2
rs.MoveNext
Looprs.Close
conn.Close
stream.Close
Set ws = Nothing
Setrs=Nothing
Set stream = Nothing
Set conn = Nothing
Wscript.Echo "All files have been released!"
Sub createFolder(thePath)
Dim i
i = Instr(thePath, "")
Do While i > 0
If fso.FolderExists(Left(thePath, i)) = False Then
fso.CreateFolder(Left(thePath, i - 1))
End If
If InStr(Mid(thePath, i + 1), "") Then
i = i + Instr(Mid(thePath, i + 1), "")
Else
i = 0
End If
Loop
End Sub