Post by r***@gmail.comHi,
I want to do a dir command that takes today's date and finds all the
folders that are older 7 days within the current directory. Is this
possible?
Thanks
Ross
This post might help you. Newsgroups: alt.msdos.batch.nt is the right group
for XP posts.
Post by r***@gmail.comI have some MSDE databases that I export to the file system on a nightly
basis, which in turn get backed up. These database exports start to take up
a sizeable amount of disk space. I would like to write a batch file that
automatically cleans them up every so often.
The exported database file names are based on the date, and constructed from
using a for statement on date/t. So an example file name would be
20040125DB.BAK.
I started expirementing with using dir | find to delete older files by
searching the "day", but started running into problems with single digit
days; ie "7" versus "07". I can perform a mathematical operiation on "7",
but not "07" without doing a lot of extra work. As an example, one batch I
wrote would delete files dated 1-9 on the 20th, delete files dated 10-20 on
the 28th, and delete files 21-31 on the 10th. A loop would be used to count
up from 1-9, and delete those files. But I ran into the "7" does not equal
"07" problem.
I was hoping someone could point me in the right direction as far as what
type of logic to use for a reliable and efficient script to accomplish this.
TIA