SAMPLE: Windows Code Module to Delete Files

ID: Q96789

The information in this article applies to:

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.

MORE INFORMATION

The following file is available for download from the Microsoft Software Library:

 ~ DELTEST.EXE (size: 27209 bytes) 

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE     : How to Obtain Microsoft Support Files from
               Online Services

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 query words: softlib DELTEST.EXE kbDSupport

Keywords          : kbsample kb16bitonly kbWinOS310 kbWinOS300 
Version           : 3.00 3.10
Platform          : WINDOWS

Last Reviewed: December 3, 1998