Re: Deleting all files from a Directory by Quincy
Quincy
Wed Nov 23 13:03:40 CST 2005
blue wrote:
> What is the fastest way to delete ALL files in a specific directory on PPC
> programatically? Thanks for answering...
>
>
Something like....?
Char directory[MAX_PATH];
HANDLE hFind;
WIN32_FIND_DATA fd;
strcpy(directory, "C:\Whatever");
SetCurrentDirectory(directory);
bRet=TRUE;
hFind = FindFirstFile("*.*", &fd);
while (hFind != INVALID_HANDLE_VALUE && bRet)
{
if (DeleteFile(fd.cFileName))
{
// file deleted OK
};
bRet = FindNextFile(hFind, &fd);
];
FindClose(hFind);
if(RemoveDirectory(directory))
{
// directory deleted OK
};
Code snipped from an old program of mine, but it gives you an idea.
Q