Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Operating System - Microsoft
Showing results for 
Search instead for 
Did you mean: 

deleting files by date

Peter Heinemann
Frequent Advisor

deleting files by date

Does anyone have a technique for deleting files on an NT/w2000 server based on date criteria? Is there a command or utility similar to the Unix "find -ctime -exec"?

Ron Kinner
Honored Contributor

Re: deleting files by date

Should work. If not just go to and search for: delete old files. Seems to be a lot of them.

Carmelo Grecia_1
Regular Advisor

Re: deleting files by date

Hi Peter,

Not Yet...

The delete commands is as follows:

Deletes one or more files.

DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

names Specifies a list of one or more files or directories
Wildcards may be used to delete multiple files. If a
directory is specified, all files within the directo
will be deleted.

/P Prompts for confirmation before deleting each file.
/F Force deleting of read-only files.
/S Delete specified files from all subdirectories.
/Q Quiet mode, do not ask if ok to delete on global wil
/A Selects files to delete based on attributes
attributes R Read-only files S System files
H Hidden files A Files ready for arc
- Prefix meaning not

If Command Extensions are enabled DEL and ERASE change as follows:

The display semantics of the /S switch are reversed in that it shows
you only the files that are deleted, not the ones it could not find.

However, deleting files depending on date is a common administrative task. To delete all files within a root folder and its subfolders depending on a last modified date, proceed as follows:

1. Create a new directory to store all files included in this example.

2. Download and install the latest version of Windows Script Host, from, to the new directory.

3.Select Start|Run and enter "cscript scriptfile.vbs".

Here, scriptfile is the full path and file name of a script tile that contains the following:

See attachment

If it aint broke, can I have it?