Computer Hope

Microsoft => Microsoft DOS => Topic started by: theruleof4 on June 07, 2020, 07:56:38 PM

Title: Batch to list if some folder is missing two especific files
Post by: theruleof4 on June 07, 2020, 07:56:38 PM
Hi guys, I would like help to create a batch script.

Here's my problem, I have a folder with many subfolders, and some of them need to have a certain image file:  "Cover.jpg", some of them have, but others are missing ... and there are hundreds of folders to check ... I managed to find this bat:

Code: [Select]
@echo off
for /d /r %%f in (*) do (
if not exist %%f\Cover.jpg (
echo %%f >>W:\HD\Cover_Missing.txt
)
)

The problem is that it returned many results, like parent folder.. then I wanted to improve it by placing the condition that in addition to having the file "Cover.jpg" having the file * .mp3 or * .m4a.. so the return would be less to analyze ....

Could someone help me by doing ... I know very little about programming

Thank you!
Title: Re: Batch to list if some folder is missing two especific files
Post by: Hackoo on June 08, 2020, 08:37:11 AM
You can try with the command Where /?
Example :
Code: [Select]
@echo off
Set Source=%~dp0
Set Pattern=Cover.jpg *.mp3 *.m4a
Where /R %Source% %Pattern% /F
pause