Sign in to follow this  
Followers 0
Juvigy

Extract zip VBS not always working

7 posts in this topic

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?

Share this post


Link to post
Share on other sites



Sounds like the files already exist at the target.

And this is not an AutoIt question...

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Why not just use the 7zip standalone and a batch file?

Edited by omikron48

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

10x. If only you had a look at this earlier (or i searched more extensively)

I just finished doing on my own what you have already done (add error checking and temp files cleaning).

Share this post


Link to post
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
Sign in to follow this  
Followers 0