Board logo

标题: [转贴] VBScript脚本解压缩目录中的所有zip文件 [打印本页]

作者: find    时间: 2012-2-29 23:15     标题: VBScript脚本解压缩目录中的所有zip文件

  1. On Error Resume Next
  2. Dim objFSO,sourcepath,targetpath
  3. Function GetZipFile(path)
  4. Dim file,folder,sfolder,subfolder,files
  5. If Not objFSO.FolderExists(path) Then
  6. Msgbox "目标文件夹不存在!"
  7. Else
  8. objFSO.CreateFolder targetpath & Right(path,Len(path)-Len(sourcepath))
  9. Set folder=objFSO.GetFolder(path)
  10. Set files=folder.files
  11. For Each file in files
  12. If StrComp(objFSO.GetExtensionName(file.name),"zip",vbTextCompare)=0 Then
  13. objShell.NameSpace(targetpath & Right(path,Len(path)-Len(sourcepath))).CopyHere objShell.NameSpace(path & "\" & file.name).Items(),256
  14. End If
  15. Next
  16. Set subfolder=folder.subfolders
  17. For Each sfolder in subfolder
  18. GetZipFile path & "\" & sfolder.name
  19. Next
  20. End If
  21. End Function
  22. Set objFSO=Server.CreateObject("Scripting.FileSystemObject")
  23. Set oApp=CreateObject("Shell.Application")
  24. sourcepath="C:\zipfiles"
  25. targetpath="D:\tmp\" & objFSO.GetFileName(sourcepath)
  26. GetZipFile sourcepath
  27. Set objFSO=Nothing
  28. Set oApp=Nothing
复制代码

http://www.jb51.net/article/29533.htm




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2