Windows Code Module to Delete Files (96789)



The information in this article applies to:

  • Microsoft Windows Software Development Kit (SDK) 3.0
  • Microsoft Windows Software Development Kit (SDK) 3.1

This article was previously published under Q96789

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 files are available for download from the Microsoft Download Center:


Deltest.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

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.

Modification Type:MinorLast Reviewed:8/4/2004
Keywords:kb16bitonly kbfile kbSample KB96789 kbAudDeveloper