Assorted NT/2000/XP/.. CMD.EXE Script Tricks
From the html version of the tscmd.zip 1cmdfaq.txt file
To the Description and the Index
This page is edited from the 1cmdfaq.txt faq-file contained in
command line interface (CLI) collection. That zipped file has much
additional material, including a number of detached .cmd script
files. It is recommended that you also get the zipped version as a
Please see "The Description and
the Index page
" for the conditions of usage and other such
98} How do I equate all zip files with the date of their latest file?
A typical archive maintainer's task.
@echo off & setlocal enableextensions
rem Covert a zip file datestamp to equal the datestamp of the
rem most recent file within the zip archive. Traverses all the
rem zip files in the default folder.
rem Needs zip.exe from
rem 355508 Oct 19 2008 zip300xn.zip
rem zip300xn.zip Info-ZIP command-line zip for Win9x/NT/2K/XP/2K3
rem or more generally http://garbo.uwasa.fi/win95/arcers.html
rem Uses the switch "-o" to "make zipfile as old as latest entry"
rem By Prof. Timo Salmi
rem Last modified Sun 27-Dec-2009
:: The zip-program needs the local Time Zone information
:: Check that there are zip files to be processed
if not exist "*.zip" goto _nofile
:: Do the timestamping
for %%f in ("*.zip") do "%ziprog%" -o %%f
:: Show the results
dir "*.zip" | find /i ".ZIP"
:: Restore the original Time Zone variable in case it had a different value
echo No .zip files found to process
endlocal & goto :EOF
Before running the script we might have
27.12.2009 20:07 21,678 test.zip
27.12.2009 19:46 1,178,993 XPAD_.ZIP
The output could be e.g.
16.10.2009 12:41 21,678 test.zip
07.12.2009 07:33 1,178,993 XPAD_.ZIP
If, instead of the Info-ZIP zip program you have the command-line
module for Winzip, substitute
set ziprog=C:\Program Files\WinZip\WZZIP.EXE
if defined ProgramW6432 set ziprog=C:\Program Files (x86)\WinZip\WZZIP.EXE
for %%f in ("*.zip") do "%ziprog%" -o %%f -x"*.*"