Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extract and save a file from zip folder using VB Script
#1
Not Solved
i need code to extract and save a file from zip folder using VB Script in QTP.
Could you please any one help me this.

Regards
Karthik
Reply
#2
Not Solved
You can use the below code.

Code:
Function UnzipFile(zipFile,ExtractTo)
    
    'The location of the zip file.
    'ZipFile="C:\Test.Zip"
    
    'The folder the contents should be extracted to.
    'ExtractTo="C:\Test\"
    
    'If the extraction location does not exist create it.
    Set fso = CreateObject("Scripting.FileSystemObject")
    If NOT fso.FolderExists(ExtractTo) Then
       fso.CreateFolder(ExtractTo)
    End If
    
    'Extract the contants of the zip file.
    set objShell = CreateObject("Shell.Application")
    set FilesInZip=objShell.NameSpace(ZipFile).items
    objShell.NameSpace(ExtractTo).CopyHere(FilesInZip)
    Set fso = Nothing
    Set objShell = Nothing

End Function
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Executing via create "RES"xx folder? nishitd 0 1,112 03-07-2018, 01:09 AM
Last Post: nishitd
  Sending json file request and validating response in soap UI tool using Groovy script smiley 0 3,648 07-19-2017, 04:58 PM
Last Post: smiley
  code for validation to create a sub folder smiley 0 1,431 10-19-2016, 10:08 PM
Last Post: smiley
  [UFT] Close opened folder robertosalemi 1 3,153 02-10-2016, 07:06 PM
Last Post: robertosalemi
  qtp script for updating values in xml file automation2012 3 11,260 11-30-2015, 11:07 AM
Last Post: Lavanya N

Forum Jump:


Users browsing this thread: 1 Guest(s)