Is there a way to find out if a directory contains a subdirectory?

I am stealing in C ++. Is there a way to find out if a directory contains a subdirectory?

It seems that CFileFind needs to be searched by shared files. It will take a long time if the only subdirectory is at the end of the list and there are many files.

for example: directory A contains 99995 files and one subdirectory at the end of the FindNextFile list. if I tried 99995 times, then I’ll say: yes, does it contain a subdirectory?

+3
source share
4 answers

Raymond Chen of Microsoft wrote a post that is probably applicable here: Calculating the size of a directory is more than just adding file sizes . Essentially, he explains that information similar to the size of the directory cannot be stored in the dir entry, as different users may have different permissions, possibly making some of the files invisible to them. Therefore, the only way to get the size that the user should see is to calculate it on request from the user.

, , . , , , , , . Windows , , .

Win32 , , , .NET, . , .

+2

.Net, Directory.GetDirectories 0. Do not , .

, , , , , .

+1

boost.

directory_iterator [ boost/filesystem/operations.hpp] , , , (is_directory - , , ) ..

. .

, MFC [ , CFileFind], . , . , FindFirstFile/FindNextFile.

+1

, .

Win32 FindFirstFile/FindNextFile , MFC CFileFind, , .

0

Source: https://habr.com/ru/post/1712533/


All Articles