How would I write a Windows Command to delete all folders recurvsively with a specific wildcard name ({*}) under a specific path that is older than 10 days? I would like to run this on the command prompt and I also want to run it as a batch file.

set deletepath = "C:\test\"
set days = 10

Delete all subfolders under deletepath that is older than 10 days and begins with "{" and ends with "}" i.e. {*}**

i would suggest you scheduled tasks

I wrote this script a few years ago to do just that. You can modify it to restrict it to specific types of names. See attached.


  delete_older_than #days [folder] [-s] [-l] 


    #days       number of days to keep 
    folder      name of folder containing files to delete 
                (default is current)
    -s          delete in sub-directories also (optional)
    -l          list files to delete withoout deleting them (optional)

Thanks for that. Is there anyway I could do this using MS-Dos commands that I can run occasionally or put into a batch file to run as a schedule job?

Is there anyway I could do this using MS-Dos commands

You can run it as a batch job. That's what scripts are for. vbs files are executed either by cscript.ece or wscript.exe. One is for command line (c) mode and the other is from windowed (w) mode. One difference is that under cscript.exe, output goes to the console window and under wscript.exe, output is to a MessageBox. You can set console as the default by

cscript //h:cscript //s

To run it automatically you can set up a task in the Task Scheduler.