schedule file to unzip

I need to unzip a file every day and I was wondering whats the best way to schedule the file to unzip to a directroy and overwrite its old files every day at a certain time?
if say the zip file is C:\file storage\new.zip and I want to unzip that to C:\file storage\new\

I am guessing that I could use a batch file to do it and then but the batch file in scheduled tasks
but what needs to be in the batch file?
BTMExpertAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TheCleanerCommented:
Someone just answered this question, I can't remember who though...it was just last week.

Winzip pro will do it:

You can schedule a WinZip Job file to run any time you wish. Click Schedule on the Specifications Complete panel of the Job Wizard. This is WinZip Pro feature.

http://www.winzip.com/hints_and_tips.htm?cnda

my thought is you could use the command line syntax with winzip pro to do it for you.

Hopefully the person (I think it was leew) that answered it last time can swing by here.
TheCleanerCommented:
LOL, well I guess you were the one that asked the question:

http://www.experts-exchange.com/Operating_Systems/Windows_Server_2003/Q_21779364.html

Did it not take care of what you needed?
BTMExpertAuthor Commented:
nope I couldn't get it working
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

TheCleanerCommented:
You should ask in the community support section to reopen that one and close this one...especially since you don't have any points now.
cwwkieCommented:
You can try 7-zip (http://www.7-zip.org/). It has a commandline interface (7za.exe)
BTMExpertAuthor Commented:
I was able to get the infozip program working its the command line part of all of this that I don't understand


and how to automate the command line part of it
cwwkieCommented:
I don't know infozip, but I can explain it for 7-zip, asuming it is simular for infozip;

Create a batchfile with the following four lines:

@echo off
c:
cd "C:\file storage\new\"
"C:\Program Files\7-Zip\7za" x -y "C:\file storage\new.zip"

The x is to eXtract, the -y option is to answer yes to all questions (do you want to overwrite?)
Because 7za is not able to extract to another directory than the current directory, the current directory is first changed to the directory where the files must be stored.
TheCleanerCommented:
LOL I thought I posted the command line earlier today...oh well...I downloaded infozip and it should be:

unzip -Z -ddo "C:\file storage\new.zip" -d "C:\file storage\new\"

OR maybe

unzip -ddo "C:\file storage\new.zip" -d "C:\file storage\new\"

The options are confusing, Let us know...
TheCleanerCommented:
Ah...I posted it in the other question:

I went ahead and downloading Infozip to see the program.

The command line looks like it would be:

unzip -ddo "c:\file storage\new.zip" -d "c:\file storage\new"

or

unzip -Z -ddo "c:\file storage\new.zip" -d "c:\file storage\new"


You'll need to test it...

Then when it is right...put it in a notepad doc, and then Save As, unzipbatch.bat (make sure you change it to all files when saving it or it will end up as unzipbatch.bat.txt)

Then open task scheduler and set up a scheduled task to run that batch file.


NOTE:  the batch file and the unzip program needs to be in the same location.
cwwkieCommented:
> Ah...I posted it in the other question:

Yes, that is the disadvantage of having two questions. I did not subscribe to the other one, so I did not see it.
BTMExpertAuthor Commented:
ok I am in my cmd prompt I make sure I am in the C:\Program Files\Wiz directory where info zip said I should install it and I type in the what you suggested but I get the error 'unzip' is not recognized as an internal or external command, operable program or batch file.

I tried looking for the command line commands for it in the help section of info zip but couldn't find anything about command lines
TheCleanerCommented:
look in that directory for the unzip.exe file (or do a search for it).  That's where the command line should be typed out.

The help file I referred to is in the unzip.txt file
TheCleanerCommented:
Oh...btw...the whole "Wiz" directory thing...I didn't run an install.  Just downloaded the unz552xN.exe from their site, and ran the exe (inside a command prompt) and it extracted all of the files.  No need to install anything...
BTMExpertAuthor Commented:
I don't see a file called unzip.txt in that directory we are both talking about info zip 5.03 right?
TheCleanerCommented:
Here's what I did:

Go to info-zip.org

Then clicked on this link:

ftp://ftp.info-zip.org/pub/infozip/

There I clicked on Win32 directory and it got me here:

ftp://ftp.info-zip.org/pub/infozip/WIN32/

The readme says that the file needed is unz552xN.exe

so I downloaded that to a new folder and went to a command line in that folder and ran the .exe to extract it all.
BTMExpertAuthor Commented:
ok so I changed the
unzip -ddo "c:\file storage\new.zip" -d "c:\file storage\new"

to

wiz.exe -ddo "c:\file storage\new.zip" -d "c:\file storage\new"

and now its opening up the info zip program but I am getting a prompt that says "Can't open -ddo "c:\file storage\new.zip" -d "c:\file storage\new""
TheCleanerCommented:
Try the last post I put up...I think you have the GUI version going.
BTMExpertAuthor Commented:
I don't understand what you mean

I have the program installed and working properly
I am just trying to get it to unzip a file using the command line
TheCleanerCommented:
I think you got the wrong version.

Go through my steps above to download the command line version.  Then run the command.
BTMExpertAuthor Commented:
ok the command line is now working but it still isn't unzipping
so to simplify it I moved the files into the root of C: and was trying this


C:\Program Files\Wiz>unzip -ddo "c:\test.zip" -d "c:\testfiles\"
Archive:  c:/test.zip
caution: filename not matched:  -d
caution: filename not matched:  c:/testfiles/

C:\Program Files\Wiz>unzip -Z -ddo "c:\test.zip" -d "c:\testfiles\"
ZipInfo 2.42 of 28 February 2005, by Greg Roelofs and the Info-ZIP group.

List name, date/time, attribute, size, compression method, etc., about files
in list (excluding those in xlist) contained in the specified .zip archive(s).
"file[.zip]" may be a wildcard name containing *, ?, [] (e.g., "[a-j]*.zip").

   usage:  zipinfo [-12smlvChMtTz] file[.zip] [list...] [-x xlist...]
      or:  unzip -Z [-12smlvChMtTz] file[.zip] [list...] [-x xlist...]

main listing-format options:             -s  short Unix "ls -l" format (def.)
  -1  filenames ONLY, one per line       -m  medium Unix "ls -l" format
  -2  just filenames but allow -h/-t/-z  -l  long Unix "ls -l" format
                                         -v  verbose, multi-page format
miscellaneous options:
  -h  print header line       -t  print totals for listed files or for all
  -z  print zipfile comment   -T  print file times in sortable decimal format
  -C  be case-insensitive     -M  page output through built-in "more"
  -x  exclude filenames that follow from listing


so I think its just the syntex error
TheCleanerCommented:
try the first one again as simply

unzip "C:\test.zip" -d "C:\Program Files\Wiz"

and see if it unzips to the Wiz folder...then we can go from tehre...
BTMExpertAuthor Commented:
ok that worked
is it that the folder has to be created to start with?

and how can I set it so it replaces them all without prompting
TheCleanerCommented:
go ahead and create the folder it's going to be extracted to.

then try the command as:

unzip -do "C:\test.zip" -d "C:\Program Files\Wiz"

the unzip.txt has the command line options, but good luck trying to figure it out...it's pretty cryptic.

the -do should do a silent overwrite.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TheCleanerCommented:
Thank you for the points!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.