CPB Mailing List
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Deleting files using wildcards
On Wednesday, March 04, 1998 5:44 PM, Adolfo León [SMTP:aleon@serconet.com]
wrote:
> How can I delete files using wildcards (*.dat,*.txt)
Hi,
Here is a littre piece of code which might helps you:
WIN32_FIND_DATA dataFound;
HANDLE fileHandle;
fileHandle = FindFirstFile("*.dat", &dataFound); // or whatever your mask is
if (fileHandle != INVALID_HANDLE_VALUE) {
DeleteFile(dataFound.cFileName);
while( FindNextFile(fileHandle, &dataFound))
DeleteFile(dataFound.cFileName);
}
This will delete all *.dat files in the current directory. You can give a
full path (or a relative one) to FindFirstFile.
Hoping this helps!
Yves St-Hilaire
yves@adopt.qc.ca
W Komornicki's Home Page |
Main Index |
Thread Index