Auto delete based on date

March 30, 2010 at 09:33:20
Specs: Windows XP
I'm trying to write a batch file that will do the following:

operate in an autoexec mode on a floppy., when run ---
- pull current date from c: drive
- compare date to one I have already coded into the batch file
- if current date is later than the predetermined date, then the batch file will erase specific (or all) file(s) on the floppy.

I need this for my wife who is teacher at a community college. She hands out (mails out) tests via the floppy and this batch is needed to ensure the test is not copied or available for use beyond a certain date thus comprising it preventing its use into subsequent semesters.

Any help is appreciated.

Thank you.

See More: Auto delete based on date

Report •

March 30, 2010 at 10:46:44
Before we begin, you do realize this has all the security of the traditional honor system, do you not?

Report •

March 30, 2010 at 11:16:51
yes, I undeerstand

Report •

March 30, 2010 at 11:38:21
Since we got that out of the way, let me say this now: Batch scripts don't do dates, and they don't do date math. VBScript (or a compiled program) would be a better solution.

Const killDate = #3/30/2010 14:32#
If Now < killDate Then _

Set fso = CreateObject("Scripting.FileSystemObject")
For Each file In Array("file1.txt", _
                  "file2.txt", _
                  "file3.txt", _
                  "file4.txt", _
  fso.DeleteFile file, True
Next 'file

Report •
Related Solutions

Ask Question