Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automatically Zip files based on date? NEWbie

Status
Not open for further replies.

Delphiwhat

Programmer
Apr 1, 2003
74
EU
Hi all

Hope someone can point me inthe right direction.

I have a folder consisting of hundreds of files. What I want to do is automatically zip them based on date. The program or script should run automatically.

Can this be done using awk scrpt?

so all files from 01/01/2005
to 10/01/2005

should be zipped into
01012005.zip file

The server is win nt box

thanks for you help
 
awk is a Unix based tool not readily available on the Windows platform. As the windows script tools are, quite frankly, pathetic you might want to look at downloading perl.

Columb Healy
 
Columb:
Actually awk is readily available, in the form of gawk, from GnuWin32, as is most of the GNU tools. Get it here. And there's always Cygwin.
As for the Windows tools being pathetic. Well, they aren't exactly great but certainly good enough for this task, and both awk and perl would probably be overkill. Actually I've made a complete web-gallery script using only standard Win2k commands, ImageMagick and Sed (only for simple substitutions). Sure, it was a pain and have a number of limitations, but it could be done. Sample.

Delphiwhat:
I'll need more info to be able to help you:
When you say NT, do you mean NT4 or just NT-based (2000, XP, 2003)? I guess you mean NT4, but it's quite important to know. Also if you have any Resource Kits installed (not service packs).
What about the rest of the files? Are only some of them going to be zipped? The exact rules for when and which would be a good idea as well ;-)
Do you already have a commandline compressor? if not.

To see a list of most of the commands available type HELP in a command prompt.
The commands you'll likely be using is: DIR, FOR and AT. Perhaps a few more. DIR to get the dates and corresponding file names, FOR to process the files and AT for scheduling.

You should have a look here. It's a great resource on Windows batch scripting.
Also alt.msdos.batch.nt seems to be fairly active.

- Nis Donatzsky
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top