SAMPLE: Windows Code Module to Delete Files

Last reviewed: February 15, 1996
Article ID: Q96789
The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) for Windows versions 3.0 and 3.1

SUMMARY

The DELTEST sample contains a complete code module to delete one or more files by using wildcards. The sample also demonstrates how to use wildcards to search through an entire directory.

Download DELTEST.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:

  • Microsoft Download Service (MSDL)

          Dial (206) 936-6735 to connect to MSDL
          Download DELTEST.EXE (size: 27209 bytes) 
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the \SOFTLIB\MSLFILES directory
          Get DELTEST.EXE (size: 27209 bytes) 
    

MORE INFORMATION

The C Run-time contains a function to delete one file, but does not allow a program to delete multiple files using wildcard characters. The DELETE.C module included with this sample can be used with any application or dynamic-link library (DLL) to perform this operation. This module uses the _dos_findfirst/next functions in conjunction with the remove() function to allow multiple files to be erased.

NOTE: In the sample, if "Delete tmp Files" is selected from the menu, the two .TMP files included with the sample will be erased.

For information on how to call the Delete() function, please refer to the comment block inside of DELETE.C.


Additional reference words: 3.00 3.10 softlib DELTEST.EXE
KBCategory: kbprg kbfile
KBSubcategory: KrFileIO


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.

Last reviewed: February 15, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.