Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the count of files in a directory

How can I count the files in a directory? I couldn't find anything relevant in the class reference of NSFileManager.

like image 688
Sean Avatar asked Feb 17 '10 09:02

Sean


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 you get files count in a directory in Linux?

The easiest way to count files in a directory on Linux is to use the “ls” command and pipe it with the “wc -l” command. The “wc” command is used on Linux in order to print the bytes, characters or newlines count. However, in this case, we are using this command to count the number of files in a directory.

How do I count the number of files in a folder in Windows 10?

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.


1 Answers

contentsOfDirectoryAtPath:error: returns an NSArray. Just send count to the array.

like image 84
Benedict Cohen Avatar answered Sep 19 '22 07:09

Benedict Cohen