Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Retrieve file extensions from folder structure (recursive)?

Posted on 2010-09-06
3
Medium Priority
?
529 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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

971 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