Trish Pham
Trish Pham

Reputation: 479

List only image files in folder

How do I list only image files inside a folder? like jpg, gif, png, bmp

This is the code I got so far. What it does is it makes a dirlist in each subfolder and lists all the files. Now I want to list only image files. How can you do it using windows cmd?

@echo off
for /r "C:\Documents and Settings\Administrator\Billy\Artworks\" %%d in (.) do dir /s/b "%%~fd" > "%%~dpnd\dirlist.txt"

Upvotes: 1

Views: 1346

Answers (1)

Alex K.
Alex K.

Reputation: 175876

Simply add a file extension filter;

....works\" %%d in (*.gif;*.jpg;*.jpeg;*.png;*.bmp;*.tiff) do dir /s/b "% ...

Upvotes: 2

Related Questions