Solved

Retrieve file extensions from folder structure (recursive)?

Posted on 2010-09-06
3
522 Views
Last Modified: 2012-05-10
I've a folder structure starting from c:\data and need to know all FILE EXTENSIONS used, recursively? Rgds
0
Comment
Question by:go4java
3 Comments
 
LVL 2

Expert Comment

by:DavidGerald
ID: 33609879
A bit vague, why recursively?

Is it because you need to get a list of all files with extention of type A, then another list of all extentions type B, then type C etc?  Or do you just need a list of files with ordered by extention?
 Do you just need to know what extentions there are and how many?

0
 

Author Comment

by:go4java
ID: 33609923
..yes, I need a list of all file extensions and they I will have extract certain file types.
I just found a way with Total Commander, sleceting all file types *.* and retrieving all exztensions ftom that list. Thnaks
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 500 total points
ID: 33610131
How about this batch file.  It will keep a running count of all files.  remove the line

  echo %%~xA, !%%~xA!

to stop the progress details and speed it up somewhat...

Steve

@echo off
setlocal enabledelayedexpansion
cd /d c:\data
for /F "tokens=*" %%A in ('dir /a-d /b /s *.*') do (
  set /A %%~xA=!%%~xA! + 1
  echo %%~xA, !%%~xA!
)
set . > extensions.txt
endlocal
START notepad extensions.txt

You end up with something like this in a text file in Notepad:


.bat=11
.bmp=2
.cmd=233
.csv=5
.db=1
.exe=3
.htm=7
.html=2
.jpg=3
.js=4
.lnk=1
.mbf=1
.php=1
.prn=3
.reg=2
.sep=1
.sk=1
.txt=36
.vbs=46
.xls=1
.zip=1

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question