On Mar 10, 9:22=A0am, tcdrake <rymi...@[EMAIL PROTECTED]
> wrote:
> On Mar 7, 8:58=A0pm, Ted Davis <tda...@[EMAIL PROTECTED]
> wrote:
>
>
>
> > On Fri, 07 Mar 2008 07:32:06 -0800, tcdrake wrote:
> > > On Mar 7, 9:25=A0am, tcdrake <rymi...@[EMAIL PROTECTED]
> wrote:
> > >> I get 80 zips each day. So today the zips will be named
20080306-1.zi=
p,
> > >> 20080306-2.zip, 20080306-3.zip, etc.. The number after the dash is
th=
e
> > >> 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.-
Hi=
de
> > >> quoted text -
>
> > I can't test this with TAWK - I'm not sure I even still have it on any
o=
f
> > my machines, definitely not on this one.
>
> > Assuming that the location map is exported from Excel as a tab
delimited=
> > file with each entry on a separate line in the form
>
> > number_in_filename\tdestination_directory
>
> > then this batch file generates another batch file to do the actual
work.=
>
> > =A0 @[EMAIL PROTECTED]
off
> > =A0 dir /b *.zip | awk -fscript_file.awk map_file.txt - > }{.cmd
>
> > when satisfied that }{.cmd does what you want, add these two lines
>
> > =A0 call }{
> > =A0 del }{.cmd
>
> > The script is commented and in fully expanded syntax for clarity.
>
> > BEGIN{
> > =A0 =A0 =A0 =A0 UnZipCommand1 =3D "c:\\progra~1\\winzip\\wzunzip.exe
-e =
-s "
> > =A0 =A0 =A0 =A0 UnZipCommand2 =3D " c:\\test\\"
> > # Making the field separator -, ., or TAB makes it work for both
> > # the file name and the tab delimited map file.
> > =A0 =A0 =A0 =A0 FS =3D "[-.\t]"
> > =A0 =A0 =A0 =A0 print "@[EMAIL PROTECTED]
off"}
>
> > {
> > =A0 =A0 =A0 =A0 if( NR =3D=3D FNR ) {
> > # The file containing the location map.
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Table[ $1 ] =3D $2
> > =A0 =A0 =A0 =A0 }
> > =A0 =A0 =A0 =A0 else {
> > # The directory listing on STDIN
>
> > # The source is the filename in the DIR listing.
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Fname =3D $0
> > # The target is the given parent directory followed by the location
> > # from the map file corresponding to the location number in the
> > # file name (the second field).
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Target =3D Table[ $2 ]
> > # It may be desirable to ad a trailing "\\" to the command.
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Command =3D UnZipCommand1 Fname
UnZipCom=
mand2 Target
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 print Command
> > =A0 =A0 =A0 =A0 }
>
> > }
>
> > If it doesn't work with TAWK, install gawk - it's better for almost
> > everything except that it doesn't have true multidimensional arrays
and
> > isn't a compiler <http://gnuwin32.sourceforge.net/packages/gawk.htm>.
>
> > Using this map
>
> > 1 =A0 =A0 =A0 101
> > 2 =A0 =A0 =A0 102
> > 3 =A0 =A0 =A0 103
> > 4 =A0 =A0 =A0 104
> > 5 =A0 =A0 =A0 105
>
> > and files named 20080307-1.zip,20080307-2.zip, 0080307-3.zip,
> > 20080307-4.zip, and 20080307-5.zip
>
> > it generated this output file (lines may have wrapped)
>
> > @[EMAIL PROTECTED]
off
> > c:\progra~1\winzip\wzunzip.exe -e -s 20080307-1.zip c:\test\101
> > c:\progra~1\winzip\wzunzip.exe -e -s 20080307-2.zip c:\test\102
> > c:\progra~1\winzip\wzunzip.exe -e -s 20080307-3.zip c:\test\103
> > c:\progra~1\winzip\wzunzip.exe -e -s 20080307-4.zip c:\test\104
> > c:\progra~1\winzip\wzunzip.exe -e -s 20080307-5.zip c:\test\105
>
> > --
>
> > T.E.D. (tda...@[EMAIL PROTECTED]
) MST (Missouri University of Science and
Technolo=
gy)
> > used to be UMR (University of Missouri - Rolla).
>
> After installing GAWK everything worked. Thank you for all your help.
I have run across something else I would like. I only need certain
files unzipped. I know in winzip I can call a list which has all the
files I want to unzip. The command for this is wzunzip.exe -e -s
20080307-5.zip @[EMAIL PROTECTED]
c:\test\105. Any chance you can assist in
adding this feature?


|