Mail Archives: djgpp/1997/02/25/04:41:13
On 25 Feb 1997, Craig Bolland wrote:
> I need help writing a simple DOS batch file that creates a file called
> DDMMYY.zip every day, where DD is today's date, MM is the month and YY is
> the year.
Are you sure a simple C program isn't what you need? You can spawn PKZIP
from it after constructing the command line.
If you somehow need to do it with a batch file, it's possible, but
tricky. You write a batch file which does this:
1) Writes the date to a file (DOS `date' won't work, because it
cannot be redirected, but GNU `date' from Sh-utils will). Let's call
this file DATE.DAT.
2) Calls Sed to edit the contents of DATE.DAT into a batch file
which will call PKZIP with the command-line you need .
3) Calls the second batch file.
- Raw text -