KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q67381: Deleting Files Based on Creation Date

Article: Q67381
Product(s): Microsoft Disk Operating System
Version(s): MS-DOS:3.20,3.21,3.30,3.30a,4.0,4.01,5.0,5.0a
Operating System(s): 
Keyword(s): 
Last Modified: 19-NOV-1999

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft MS-DOS operating system versions 3.20, 3.21, 3.30, 3.30a, 4.0, 4.01, 5.0, 5.0a 
-------------------------------------------------------------------------------

SUMMARY
=======

MS-DOS versions before 6.x do not provide a direct means of deleting a file
based upon its creation date. However, you can perform this function by using a
sequence of MS-DOS commands, executed from the directory in which the files to
be deleted reside, as follows:

  md newfiles                     (Creates subdirectory NEWFILES)

  xcopy *.* newfiles /d:date      (Copies all files from current
                                  directory created on or after
                                  date to the subdirectory
                                  NEWFILES*)

  del *.*                         (Deletes all files in current
                                  directory)

  xcopy newfiles                  (Copies files from NEWFILES to
                                  current directory)

  del newfiles                    (Deletes all files in subdirectory
                                  NEWFILES)

  rd newfiles                     (Removes subdirectory NEWFILES)

- Please note that this procedure requires enough free disk space to maintain
  two copies of all of the files in the current directory that will be saved.

With MS-DOS version 6.x the final two steps can be replaced with:

  deltree newfiles

Additional query words: 3.20 3.30 3.30a 4.00 5.00 noupd

======================================================================
Keywords          :  
Technology        : kbMSDOSSearch kbMSDOS321 kbMSDOS400 kbMSDOS500 kbMSDOS401 kbMSDOS500a
Version           : MS-DOS:3.20,3.21,3.30,3.30a,4.0,4.01,5.0,5.0a

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.