只要你有一台电脑或者手机,都能关注图老师为大家精心推荐的整站二进制数据库文件还原,手机电脑控们准备好了吗?一起看过来吧!
【 tulaoshi.com - Web开发 】
  昨天一个在落伍的朋友给的,一个站的所有文件和图片以二进制的方式放进了数据库里,用下面的代码可以把数据库里的文件和图片还原出来。
  把得到的数据库名字改成ToMdb.mdb,然后把下面的代码保存成VBS格式。放在同一个目录下,执行这个VBS文件
  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
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/webkaifa/)  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
  Loop
  rs.Close
  conn.Close
  stream.Close
  Set ws = Nothing
  Set rs = Nothing
  Set stream = Nothing
  Set conn = Nothing
Wscript.Echo "所有文件释放完毕!"
  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
来源:http://www.tulaoshi.com/n/20160219/1621149.html
看过《整站二进制数据库文件还原》的人还看了以下文章 更多>>