List image files only (cmd)

Discussion in 'Programming' started by Ruriko, Oct 31, 2012.

  1. #1
    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"
    Code (markup):
     
    Ruriko, Oct 31, 2012 IP
  2. sandeepdude

    sandeepdude Well-Known Member

    Messages:
    1,741
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    195
    #2
    Below will list image files alone...
    
    @echo off
    FOR /R "C:\Documents and Settings\Administrator\Billy\Artworks\" %%G IN (*.jpg,*.bmp,*.png,*.gif) do echo %%~fG  >> %%~pG\dirlist.txt
    
    Code (markup):
    Hope it helps...:)
     
    sandeepdude, Oct 31, 2012 IP
  3. Ruriko

    Ruriko Well-Known Member

    Messages:
    4,023
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    130
    #3
    thank you! you are now my best friend :)
     
    Ruriko, Oct 31, 2012 IP