更新时间:2022-05-25 17:27:49
如果不能使用.NET&托管代码,您可以通过win32 api的
If you can't use .NET & Managed code, you can go through the win32 api's
Here is an example that you can modify to only get Folders.
(基本上是下面的检查:)
(Basically the following check:)
...
TCHAR szDir = _T("c:\\"); // or wherever.
HANDLE hFind = FindFirstFile(szDir, &ffd);
...
do {
if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
// your code on 'ffd'
}
} while (FindNextFile(hFind, &ffd) != 0);