2

What I want to do:

write a batch script to do the following loop though all dir starting with "01-"... Check if "Pictures" folder is empty or not. skip rest folders If "Pictures" folder is Empty, than print path of empty "Pictures" folders.

Output Example:

MainFolder/01-Folder3/Pictures is empty

Structure of my folder:

1st lvl... Every thing inside my "MainFolder" 2nd lvl... all folders start with a number ex: 01, 02, 03, etc... 3rd lvl... There is folder called "Pictures"... in every 3rd lvl here is an example:

|>MainFolder |--->01-Folder1 |------->Pictures |----------->pic.png |----------->SubPicFolder |------->RandomFolder1 |------->RandomFolder2 |--->01-Folder2 |------->Pictures |----------->SubPicFolder |------->RandomFolder1 |--->01-Folder3 |------->Pictures |------->RandomFolder1 |--->02-Folder1 |------->Pictures |------->RandomFolder1 |------->RandomFolder1 

What I have tried?:

@echo off for /d /r %%A in ("Pictur*") do ( dir /a /b "%%~fA" 2>nul | findstr "^" >nul || echo %%~fA ) pause 

Problem with what I have tried:

This code does print all empty "Pictures" folder but issue is that it checks all the folder. I just want to check folder starting with "01-" and subfolder "Pictures". skip rest.

0

1 Answer 1

0
for dirname in `find ./ -type d | grep Pictures`; do if [ $(find $dirname -type f|wc -l) -eq 0 ]; then echo "$dirname is empty"; fi; done 

Replace find ./ with the find $RootDir for your search.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.