In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "vbs how to achieve mdb packaging and unpacking", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "vbs how to achieve mdb packaging and unpacking" this article.
Pack.vbs is used to package folders, and the root directory is the directory where the files are located.
The code is as follows:
Dim n, ws, fsoX, thePath
Set ws = CreateObject ("WScript.Shell")
Set fsoX = CreateObject ("Scripting.FileSystemObject")
ThePath = ws.Exec ("cmd / c cd") .StdOut.ReadAll () & "\"
I = InStr (thePath, Chr (13))
ThePath = Left (thePath, I-1)
N = len (thePath)
On Error Resume Next
AddToMdb (thePath)
Wscript.Echo "the current directory has been packaged and the root directory is the current directory"
Sub addToMdb (thePath)
Dim rs, conn, stream, connStr
Set rs = CreateObject ("ADODB.RecordSet")
Set stream = CreateObject ("ADODB.Stream")
Set conn = CreateObject ("ADODB.Connection")
Set adoCatalog = CreateObject ("ADOX.Catalog")
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=Packet.mdb"
AdoCatalog.Create connStr
Conn.Open connStr
Conn.Execute ("Create Table FileData (Id int IDENTITY (0jue 1) PRIMARY KEY CLUSTERED, thePath VarChar, fileContent Image)")
Stream.Open
Stream.Type = 1
Rs.Open "FileData", conn, 3,3
FsoTreeForMdb thePath, rs, stream
Rs.Close
Conn.Close
Stream.Close
Set rs = Nothing
Set conn = Nothing
Set stream = Nothing
Set adoCatalog = Nothing
End Sub
Function fsoTreeForMdb (thePath, rs, stream)
Dim i, item, theFolder, folders, files
SysFileList = "$" & WScript.ScriptName & "$Packet.mdb$Packet.ldb$"
Set theFolder = fsoX.GetFolder (thePath)
Set files = theFolder.Files
Set folders = theFolder.SubFolders
For Each item In folders
FsoTreeForMdb item.Path, rs, stream
Next
For Each item In files
If InStr (LCase (sysFileList), "$" & LCase (item.Name) & "$") 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
These are all the contents of the article "how to package and unpack mdb in vbs". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.