Link to home
Create AccountLog in
Avatar of BTMExpert
BTMExpert

asked on

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?
Avatar of TheCleaner
TheCleaner
Flag of United States of America image

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.
LOL, well I guess you were the one that asked the question:

https://www.experts-exchange.com/questions/21779364/schedule-file-to-unzip-on-webserver.html

Did it not take care of what you needed?
Avatar of BTMExpert
BTMExpert

ASKER

nope I couldn't get it working
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.
You can try 7-zip (http://www.7-zip.org/). It has a commandline interface (7za.exe)
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
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.
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...
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.
> 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.
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
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
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...
I don't see a file called unzip.txt in that directory we are both talking about info zip 5.03 right?
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.
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""
Try the last post I put up...I think you have the GUI version going.
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
I think you got the wrong version.

Go through my steps above to download the command line version.  Then run the command.
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
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...
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
ASKER CERTIFIED SOLUTION
Avatar of TheCleaner
TheCleaner
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Thank you for the points!