Search code examples
c++qtqt4

Counting file in a directory


I want to count number of file in a directory, I used count method in QDir class but it always return number of file plus two! why does it do this work ? thanks


Solution

  • QDir.count() returns the total count of files and directories in the directory. This includes the . (this) and .. (parent) directory entries. So the count is always two more than the "real" files and subdirectories.