OSDN Git Service

Version 3.00
[vbslib/main.git] / vbslib / vbslib300 / zip / zip.vbs
diff --git a/vbslib/vbslib300/zip/zip.vbs b/vbslib/vbslib300/zip/zip.vbs
new file mode 100644 (file)
index 0000000..e407bfd
--- /dev/null
@@ -0,0 +1,47 @@
+Option Explicit \r
+\r
\r
+'********************************************************************************\r
+'  <<< [unzip2] >>> \r
+'********************************************************************************\r
+Sub  unzip2( ZipPath, ExpandFolderPath )\r
+  Dim  r\r
+  Dim  ex\r
+\r
+  Set ex = g_sh.Exec( """" + g_vbslib_ver_folder + "zip\unzip2.exe"" """ + ZipPath + """ """ + _\r
+    ExpandFolderPath + """" )\r
+\r
+  Do While ex.Status = 0 : WScript.Sleep 100 : Loop\r
+  Do Until ex.StdOut.AtEndOfStream : WScript.Echo ex.StdOut.ReadLine : Loop\r
+  Do Until ex.StdErr.AtEndOfStream : WScript.Echo ex.StdErr.ReadLine : Loop\r
+  r = ex.ExitCode\r
+\r
+  If r <> 0 Then  WScript.Echo "Error " & r\r
+End Sub\r
+\r
\r
+'********************************************************************************\r
+'  <<< [unzip] >>> \r
+'********************************************************************************\r
+Dim  F_IfNotExist  : F_IfNotExist = 1\r
+Dim  F_IfExistsErr : F_IfExistsErr = 2\r
+Dim  F_AfterDelete : F_AfterDelete = 4\r
+\r
+Sub  unzip( FolderZipPath, NewFolderPath, Flags )\r
+  Dim  f, s\r
+\r
+  If not exist( FolderZipPath ) Then  Err.Raise  E_FileNotExist,, "\83t\83@\83C\83\8b\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81B: " + FolderZipPath\r
+  If Flags and F_IfNotExist Then If exist( NewFolderPath) Then  Exit Sub\r
+  If Flags and F_IfExistsErr Then If exist( NewFolderPath ) Then  Err.Raise  E_Others,, "\83t\83H\83\8b\83_\82ª\91\8dÝ\82·\82é\82½\82ß\93W\8aJ\82Å\82«\82Ü\82¹\82ñ\81B: " + NewFolderPath\r
+  If Flags and F_AfterDelete Then  del NewFolderPath\r
+\r
+  echo  "unzip """ + FolderZipPath + """, """ + NewFolderPath + """"\r
+  s = g_fs.GetParentFolderName( NewFolderPath )\r
+  If s = "" Then s = "."\r
+  unzip2  FolderZipPath, s\r
+\r
+  If not exist( NewFolderPath ) Then  Err.Raise  E_FileNotExist,, "\93W\8aJ\82µ\82Ä\82à\8e\9f\82Ì\83t\83H\83\8b\83_\82ª\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½\81B: " + NewFolderPath\r
+End Sub\r
+\r
+\r
\r