How to get number of specific files in a directory


Joined
Dec 26, 2015
Messages
75
Reaction score
3
I need to find a number of html files in my directory, including all subdirectories.
how do I do that with File Explorer, or with a PowerShell prompt.
 
Ad

Advertisements

Joined
Sep 26, 2017
Messages
3,042
Reaction score
588
In Command Prompt and at the folder desired such as C:\Users\YOURLOGIN\Documents type dir /o/s and press Enter. If wanting a list of specific files same thing but add the extension such as *.html. If wanting a text file add >dir.txt. Then open that file. The * is a wild card replacing a file name, handy if not knowing what is wanted. These are simple DOS commands been around for awhile, o is organized and s includes subdirectories. More using dir /? at a prompt. Not all DOS commands work in PowerShell.

Added: the total number of files in the list will be included at the bottom.
 
Last edited:
Joined
Dec 26, 2015
Messages
75
Reaction score
3
Hi Bighorn,
thank you for your reply - tip, much appreciate it.
Aparently I have over 400 html files in this folder including many subfolders.
In the second one I have close to 200 html files. This year I have to specify each count for the tax.
With simple DOS command dir *.html I do get a list of the html files, but there is no count.
Could you, please, give me the whole command line to copy/paste/?
I am using administrator prompt, have Windows 10 Home 20H2 built 19042.894
The count should be there, but is not.
Thank you for your help
TonyH

>>>
Here is the last lines of entry, next line is empty and the next line after that is the prompt.
No count.
-a---- 12/8/2020 12:40 AM 5723 xylo-australis.html

PS K:\homepage-2>
<<<

In your example I do not get past the dir /o/s/, same as all other examples I found on the net:
Unlike old DOS, the command does not even accept any / \ (page by page /p for example)
It does not matter if I type /o/s/, or \o\s\ or o\s\. The mistake of a missing back/forward slash makes no difference.
Command just puts it there anyway. I have tried all possible variations.
>>>>
PS K:\homepage-2> dir o/s
dir : Cannot find path 'K:\homepage-2\o\s' because it does not exist.
At line:1 char:1
+ dir o/s
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (K:\homepage-2\o\s:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
<<<<
 
Ad

Advertisements

Joined
Dec 26, 2015
Messages
75
Reaction score
3
Hi Bighorn,
again I thank for your reply, much appreciate it.
I have missed the last what you wrote about not all DOS commands work in the Power Shell, I have found that problem before when all other Googled commands failed.
This time I only tried your commands. They did not work.
Not sure what Windows you have but certainly these commands do not work in My up to date Administrator Windows 10 Powershell.
it is incredible that Microsoft does not include this simple thing in File explorer, and one has to rely on unreliable Google search tips.
For the lack of any other usefull tips, I can not mark this thread SOLVED because it is not.
Forum should include just simple Close this thread - i can not find and alternative ending.
My best regards, stay safe
TonyH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top