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 ++
but
> >> 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
the=
> > folder associated to each location. The location folder name is random
a=
nd
> > does not match the store number in the zip name. So from what I gather
o=
ne
> > way would be to scan the FTP incoming directory to get the ZIP names,
no=
t
> > sure how to do this in awk. I also need to figure out how to match the
z=
ip
> > 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
bat=
ch
> point of view. =A0In any case, I think a different approach is needed,
one=
> 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
for
> 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
WinZip=
> 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.


|