Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Counting file in a directory

Tags:

c++

qt

qt4

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

like image 679
amiref Avatar asked Jul 31 '11 16:07

amiref


People also ask

How do we get the count of number of files in a directory?

Browse to the folder containing the files you want to count. Highlight one of the files in that folder and press the keyboard shortcut Ctrl + A to highlight all files and folders in that folder. In the Explorer status bar, you'll see how many files and folders are highlighted, as shown in the picture below.

How do I count files in a folder and subfolders?

Use File Explorer Open the folder and select all the subfolders or files either manually or by pressing CTRL+A shortcut. If you choose manually, you can select and omit particular files. You can now see the total count near the left bottom of the window. Repeat the same for the files inside a folder and subfolder too.

How do you count the records of a file?

Using “wc -l” There are several ways to count lines in a file. But one of the easiest and widely used way is to use “wc -l”. The wc utility displays the number of lines, words, and bytes contained in each input file, or standard input (if no file is specified) to the standard output. 1.

How do I Count the number of files in a directory?

It doesn’t take into account the files in the subdirectories. If you want to count the number of files and directories in all the subdirectories, you can use the tree command. This command shows the directory structure and then displays the summary at the bottom of the output.

How to count files in Windows command line (DOS)?

Counting files in Microsoft command line (DOS) Open the Windows command line. Move to the directory containing the files you want to count and use the dir command to list all files and directories...

How to count number of lines in a directory in Linux?

Method 1: Use ls and wc command for counting number of lines in directory. Method 2: Use tree command for counting number of files in directory. Method 3: Use find command to count number of files in a directory.

How do I Count the number of hidden files in Linux?

The simplest and the most obvious option is to use the wc command for counting number of files. The above command will count all the files and directories but not the hidden ones. You can use -A option with the ls command to list hidden files but leaving out . and .. directories:


1 Answers

You should use flags QDir::Filters with QDir::NoDotAndDotDot

like image 107
Alok Save Avatar answered Oct 10 '22 15:10

Alok Save