Count number of jpg files in sub-directories

Various ad-hoc notes, links to internet sites etc.

Moderator: sjj1805

Post Reply
User avatar
sjj1805
Site Admin
Posts: 1197
Joined: Fri Oct 27, 2006 12:45 am
operating_system: Windows 10 Pro
motherboard: Hewlett Packard 2AF7
system_drive: C
32bit or 64bit: 64 Bit
processor: 2-90 gigahertz Intel Core i5 4460S
ram: 8 GB
video card: NVIDIA GeForce GT 705
sound card: P40D100-4 NVIDIA High Definition Audio
Hard_Drive_Capacity: 8 TB
Location: Birmingham UK
Contact:

Count number of jpg files in sub-directories

Post by sjj1805 » Mon Sep 23, 2024 11:35 pm

Note - Only goes one level deep and displays results in CMD shell, Could do with a modification to include more than one level and to output to TXT file
Original source:
https://stackoverflow.com/questions/401 ... -folders-b

Code: Select all

@Echo Off
SetLocal EnableDelayedExpansion

(Set selDir=D:\Chris-Sorted\Photos\2019)

For /D %%A In ("%selDir%\*") Do Call :Sub "%%A"
Timeout -1 1>Nul
Exit/B

:Sub
Set i=3
For /F "EOL=- Tokens=1-3" %%A In (
    'RoboCopy /L /E /NFL /NDL /NJH %1 null *.*') Do (
    If %%B==: (Set/A i-=1
        If !i! Equ 1 Echo(%~nx1 : %%C))

Post Reply