Jump to content

Extract zip VBS not always working


Juvigy
 Share

Recommended Posts

Hi Guys,

I have a working VBS that i use to extract ZIP files.

Set WshShell = CreateObject("Wscript.Shell")
user = WshShell.ExpandEnvironmentStrings("%UserName%")

strZipFile = "c:\128.zip"
outFolder = "c:\"
    
Set objShell = CreateObject( "Shell.Application" )
Set objSource = objShell.NameSpace(strZipFile).Items()
Set objTarget = objShell.NameSpace(outFolder)
intOptions = 256
objTarget.CopyHere objSource, intOptions

The problem is that every now and then it gives me the error "The files exists" and it doesnt work anymore.

I need to change the strZipFile = "c:\128.zip" for example to strZipFile = "c:\129.zip" and it starts working again.

Does anybody know why?

Link to comment
Share on other sites

Yes , but the files dont exist. I have triple checked that. I also have converted this in Autoit and it has the same behavior.

I suspect that the files are first extracted to a temp location and then copied to the target location.

I use the script several times a day , every day and have to update the file names 1 or 2 times per month.

Link to comment
Share on other sites

I just found a solution. I noticed that my "\local settings\temp" directory is 20gb.

Inside for every 128.zip file that i extracted there was a copy folder with the contents.

That is why it stops working - too many directories with the same name in the folder.

After "rd temp /s /q" my extract function works great again.

Link to comment
Share on other sites

I just found a solution. I noticed that my "\local settings\temp" directory is 20gb.

Inside for every 128.zip file that i extracted there was a copy folder with the contents.

That is why it stops working - too many directories with the same name in the folder.

After "rd temp /s /q" my extract function works great again.

Search forum for _ExtractZip() function. It handles that automatically.

How do I know? You'll see when you find it :)

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...