Copyright © 2003-2010 by Prof.
Last modified Fri 23-Apr-2010 20:15:31
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
83} How to archive files with a rotation of five latest generations?
I would like to archive some files periodically but only keep the last
five iterations. The directories would ideally have date names. I know
how to get a date into a directory name but I'm having a bit of trouble
trying to figure out how to delete the oldest directory.
Such a backup rotation uses moves or renames. Below is the logic. The
commands (e.g. zipping or whatever) are easily written once the simple logic
archive4 --> archive5
archive3 --> archive4
archive2 --> archive3
archive1 --> archive2
Do the new archiving to archive1 (optionally with