On Mar 28, 10:30=A0am, tcdrake <rymi...@[EMAIL PROTECTED]
> wrote:
> On Mar 26, 7:10=A0pm, Ted Davis <tda...@[EMAIL PROTECTED]
> wrote:
>
>
>
> > On Wed, 26 Mar 2008 18:18:11 -0300, Cesar Rabak wrote:
>
> > > The OP can elide all the AWK contortion using an appropriate port of
t=
he
> > > unix utility date for its OS (which I surmise is a variety of
Windows =
due
> > > the use of winzip.exe):
>
> > > C:\>c:\usr\local\wbin\date.exe
> > > Wed Mar 26 18:06:59 BST 2008
>
> > > C:\>c:\usr\local\wbin\date.exe -d yesterday Tue Mar 25 18:07:07 BST
20=
08
>
> > > C:\>c:\usr\local\wbin\date.exe -d "2 days ago" Mon Mar 24 18:07:13
BST=
> > > 2008
>
> > > These dates can be formated as above:
>
> > > C:\>c:\usr\local\wbin\date.exe +%Y%m%d 20080326
>
> > > C:\>c:\usr\local\wbin\date.exe-d yesterday +%Y%m%d 20080325
>
> > > C:\>c:\usr\local\wbin\date.exe -d "2 days ago" +%Y%m%d 20080324
>
> > True, but this is an awk group: he is known to have gawk and TAWK, but
> > is not known to have any of the other highly useful Gnu ports.
> > (<http://gnuwin32.sourceforge.net/packages.html>)
>
> > --
>
> > T.E.D. (tda...@[EMAIL PROTECTED]
) MST (Missouri University of Science and
Technolo=
gy)
> > used to be UMR (University of Missouri - Rolla).
>
> Thank you for everyones input and sorry for the delay in my response.
>
> Yes, I do agree that I have a mess on my hands. Doing the best I can
> with the limited knowledge I have. With that said I don't believe I am
> renaming the files twice. I unzip only certain files from the ZIP and
> put them in the correct directory. From there I rename them from
> emp.dbf to em080325.dbf.
>
> printf("REN c:\\po\test\users\test\\%s\\emp.dbf em%s%02s%02s.dbf\n",
> $2,substr(y["YEAR"],3,2),y["MONTH"],y["DAY"])>"C:\\test\\doit.bat"
>
> I then zip and move to another directory. All that works right now.
>
> I took a look at your script T.E.D and please correct me if I
> missunderstood what you have. It looks like your code seems to rename
> the dbf to yesterdays date. I also undertand you as saying that small
> bit of code makes my mess of a code no longer needed. Which part is no
> longer needed? I ask because your not unzipping/zipping. Is your code
> supposed to fit into a portion of the awk or batch code I already have?
Well started over and simplified the code with everyone's assistance.
I set it to unzip to a working directory, rename files, zip and move
to the correct directory based on the location code. Then process the
next zip. Here is it for everyone to see.
BEGIN{
while ( (getline < "stores.txt") > 0)
{
FILENOZIP =3D substr($0,1,(length($0) - 4))
FILEDATE =3D substr($0,1,8)
FILEDATESHRTYR =3D substr($0,3,6)
STORENUM =3D substr(FILENOZIP,10,4)
while ( (getline < "\\test\\process.txt") > 0)
{
if (STORENUM =3D=3D $1)
{
DIRECTORY =3D $2
}
}
close("\\test\\stores.txt")
printf("Processing Store Number %s Date %s Direcotry %s
\n",STORENUM,FILEDATE,DIRECTORY)
printf("DEL workingtemp\\*.*\n") > "test.bat"
printf("WINZIP c:\\progra~1\\winzip\\wzunzip.exe -e %s.zip @[EMAIL PROTECTED]
",FILENOZIP) > "test.bat"
printf("RENAME workingtemp\\tnd.DBF workingtemp\\TD%s.dbf
\n",FILEDATESHRTYR) > "test.bat"
printf("RENAME workingtemp\\ite.DBF workingtemp\\IT%s.dbf
\n",FILEDATESHRTYR) > "test.bat"
printf("RENAME workingtemp\\Gsle.DBF workingtemp\\GS%s.dbf
\n",FILEDATESHRTYR) > "test.bat"
printf("wzzip.exe -m C:\\iFtpSvc\\info\\users\\download\\test\\%s\\
%s.zip\n",DIRECTORY,FILEDATE) > "test.bat"
}
}


|