please tell me the delete command in ms dos

please tell me the command for delete a file from what date to what date.
Who is Participating?
KangaRooConnect With a Mentor Commented:
There is no such command
Could abuse pkzip for that
  pkzip -m -t<FROMDATE> -T<TODATE> <zipfile> <filemask>
then delete <sipfile>
There may be other solutions to what you are actually trying to do. Dos comes with most neccesary comands to do file-management. What do you want to do?
7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

You could generate a file list by looking on the date of each file and pass this list to the del or erase command. That needs a bit batch programming, but it should work.
Another way could be to use file attributes as a deletion marker, but the main problem (generating a list of filenames) will be the same. You can sort by date with the dir command, but you still have to process the list to a file list erase can use
1. del will not except list with files
2. you cannot use date as criterium in a dir
3. using attributes may work, without creating list files. Simply mark files you want to keep as read-only, then delete (all) which will skip the marked files. Then set attributes back.
1. I did not speak about list FILES, I thought to PIPE the file list to the del command, but this could be a problem in older DOS versions
2. You can SORT by date and process the output to generate a file list (or at least the dir command in the Windows NT-DOS can!) This is for a faster batch program which stops after the last file you wanted to delete and does not have to process the whole directory.
3. You still need an automatism to set the attributes.

BTW: As you have to write a batch file to generate the list, if you only want to delete (and not use the list for other purposes like archiving or logging the state of your harddisk) this batch file can delete the files right after inspecting their date and you don't have any problems with piping the list to other commands.

And if everything else fails, you can still start Windows, open the explorer or the File Manager (in Windows 3.x) let the program sort by date and mark the files to delete as usual.
The pkzip command is probably the esiest.  You could also download the XtreeGold 2.0 file manager.  It runs in dos.  I believe version 2.0 is the only free version.  3.0 is the last dos version and 4.0 was a lousy windows version that doesn't recognize long file names.
The use of PKZIP has one problem: it's not a true eraser, because after putting files into .ZIP container, you have to delete it.

Perhaps it's a good idea to execute a command like this:


where value for "-T" is the lowest date and "-t" the highest date.

It has an advantage: if you need to recover the file/s, you can get them back.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.