Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Retrieve file extensions from folder structure (recursive)?

Posted on 2010-09-06
3
Medium Priority
?
527 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

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 is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

704 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