Page 1 of 1

Log all File Extensions

Posted: 18 Jul 2013 00:27
by MeSH
My thread was closed and they said that if I have a new question better to create a new one because it will conflict on other user to read it... so here I am asking a new question

How to log all file extension inside that folder?

like this one

Folder\1.txt
Folder\2.txt
Folder\3.txt
Folder\4.jpg
Folder\4.jpg
Folder\1.bmp

result

txt - 3
jpg - 2
bmp - 1

thanks in advance ^_^

Re: Log all File Extensions

Posted: 18 Jul 2013 01:02
by foxidrive
This idea was developed in the past by clever people.

Add a /s and it can process subdirectories too.

Code: Select all

@echo off
for /f "delims=" %%a in ('dir /a:-d /o:n /b') do (
set /a $%%~xa+=1
)
set $
pause

Re: Log all File Extensions

Posted: 18 Jul 2013 01:11
by MeSH
foxidrive wrote:This idea was developed in the past by clever people.

Add a /s and it can process subdirectories too.

Code: Select all

@echo off
for /f "delims=" %%a in ('dir /a:-d /o:n /b') do (
set /a $%%~xa+=1
)
set $
pause


thanks! gonna test this now... btw i will put it inside "Folder" folder? or outside "Folder"?

EDIT:

w00000t!!!!! Thanks it works! now 100% I will not miss on making a patch ^_^v

EDIT 2:

what is/are the function of these codes

a:-d
:n

Re: Log all File Extensions

Posted: 18 Jul 2013 02:26
by foxidrive
MeSH wrote:what is/are the function of these codes

a:-d
:n


/a:-d removes all folders from the list, as some may have a period in them which would be treated as an extension.

/o:n sorts by name. It is not needed.

dir /?
will give you the help for dir.