On Mar 7, 8:01=A0am, tcdrake <rymi...@[EMAIL PROTECTED]
> wrote:
> On Mar 6, 3:47=A0pm, Ted Davis <tda...@[EMAIL PROTECTED]
> wrote:
>
>
>
>
>
> > On Thu, 06 Mar 2008 12:44:23 -0800, tcdrake wrote:
> > > On Mar 6, 1:25=A0pm, tcdrake <rymi...@[EMAIL PROTECTED]
> wrote:
> > >> We recieve zip files in the following format...yyyymmdd-#.zip where
#=
> > >> starts at 1 and increments up to 79. I need to unzip these files
into=
> > >> seperate folders based on a specified folder name. Here is what I
> > >> have....
>
> > >> BEGIN{
> > >> timetab(z,time() - 86400)
>
> > >> printf("c:\\progra~1\\winzip\\wzunzip.exe -e -s %s%02s%02s-.zip c:\
> > >> \test\\1\n",z["YEAR"],z["MONTH"],z["DAY"]) =A0> "test.bat"
> > >> printf("c:\\progra~1\\winzip\\wzunzip.exe -e -s %s%02s%02s-.zip c:\
> > >> \test\\2\n",z["YEAR"],z["MONTH"],z["DAY"]) =A0> "test.bat"
>
> > >> }
> > >> As you can see I have the date portion down its the # after the
dash =
in
> > >> the zip name I don't know how to do. I'm pretty sure I need the ++
bu=
t
> > >> not sure how.
>
> > >> thanks.
>
> > > I think I need to add more info....
>
> > > We have 80 zip files coming into one FTP directory each day labled
> > > yyyymmdd-(store number).zip. These will then need to be extracted to
t=
he
> > > folder associated to each location. The location folder name is
random=
and
> > > does not match the store number in the zip name. So from what I
gather=
one
> > > way would be to scan the FTP incoming directory to get the ZIP
names, =
not
> > > sure how to do this in awk. I also need to figure out how to match
the=
zip
> > > to the correct folder it needs to be extracted to. Any ideas?
>
> > XP batch plus gawk is my strong suite. =A0That code is broken from the
b=
atch
> > point of view. =A0In any case, I think a different approach is needed,
o=
ne
> > based on gawk specific functions. =A0I would start with a batch
wrapper
>
> > =A0 @[EMAIL PROTECTED]
off
> > =A0 dir /b ftp_directory | awk -fscript > }{.bat
>
> > I can only do part of the script without knowing how to map the
location=
> > number to the target directory (I'll do this in fully expanded syntax
fo=
r
> > clarity)
>
> > =A0 BEGIN{
> > =A0 =A0 =A0 =A0 UnZip Command1 =3D "c:\\progra~1\\winzip\\wzunzip.exe
-e=
-s "
> > =A0 =A0 =A0 =A0 UnZip Command2 =3D
> > =A0 }
>
> > =A0 {
> > =A0 =A0 =A0 =A0 match( $0, /([0-9]+)-([0-9]+)\.zip, Array)
> > =A0 =A0 =A0 =A0 FileNameDate =3D Array[ 1 ]
> > =A0 =A0 =A0 =A0 Location =3D Array[ 2 ]
> > =A0 }
> > .....
>
> > Actually, it's easier to do a a pure batch file.
>
> > =A0 for /f "tokens=3D1,2,3 delims=3D.-" %%A in ('dir /b *.zip') do
> > "c:\program files\winzip\wzunzip.exe" -e -s %%A%-%B.%%C c:\test\%%B\
>
> > All one line. =A0Not tested (I'm running out of time and don't have
WinZ=
ip
> > anyway).
>
> > --
> > T.E.D. (tda...@[EMAIL PROTECTED]
)- Hide quoted text -
>
> > - Show quoted text -
>
> Thanks T.E.D. I'll have to spend some time checking this out but will
> update if/when I run into trouble.- Hide quoted text -
>
> - Show quoted text -
Here is where I am at....
I tried the batch file. Unfortunitly with what you had the zip name
ended up have the letters EB in it. Here is the output I recieved.
C:\tawk>"c:\program files\winzip\wzunzip.exe" -e -s 20080305EB. c:\test
\zip\
WinZip(R) Command Line Support Add-On Version 1.1 SR-1 (Build 6224)
Copyright (c) WinZip Computing, Inc. 1991-2004 - All Rights Reserved
Password?
ERROR: Zip file 20080305EB. does not exist
Program is terminating!
The zip file name was 20080305-30.zip. I changed the batch and deleted
the %B reference. This caused the zip to be unzipped to the root of
test folder.
Let me try to give me info on what I am trying to do.
I get 80 zips each day. So today the zips will be named
20080306-1.zip, 20080306-2.zip, 20080306-3.zip, etc..
The number after the dash is the location number. I need to unzip each
location to a folder based on different location numbers. So location
1 based on the zip name goes to location 090909. Location 2 based on
the zip name goes to location 034850987. I have an excel file which
assigns locations to each other. Does that help? I hope so as I could
really use the help on this.


|