find 0 bytes file in a folder

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,

In part of a batch, I need to evaluate if two (maybe three) text files with
known names exist in the current folder and if they are, check they are not
empty.
The first part is easy, but I got stuck on the second.

Ideally, I'd like batch to stop checking and do something as soon as the
first 0 bytes file found, but this isn't critical, there won't be many files
in this folder, I can live with evaluating every single file.

I have isolated second part into this:
@echo off
setlocal
set crap=
for %%i in (*) do (
set crap=%%~zi
call :check
)
goto end

:check
if %crap% EQU 0 (
echo found
pause
)
goto:eof

:end
endlocal & goto:eof

The above works, but I have the feelings it can be done differently, better.
For some reason I'm in mental block with this task, hence asking for help.
Oh, and I'd like to avoid using enabledelayedexpansion (if possible),
external files and utilities. OSes this batch needs to work on: W2k, XP and
W2k3.


.



Relevant Pages

  • Re: How do I change default permissions for shares?
    ... Doing a batch would mean ... Explorer so the only thing you need to is type in the share name the script ... If your share name is always the folder name or the folder name with ... @echo off ...
    (microsoft.public.windowsxp.security_admin)
  • Re: FORFILES Command
    ... I followed Pegasus' instructions to the letter and I was able to get the desired result. ... Should be ok, but just checking if we just need to schedule the .bat file execution, or is there anything else we would need to do? ... You should explain your folder structure a bit more. ... This Batch will create a new batch file containing all the delete commands. ...
    (microsoft.public.scripting.vbscript)
  • Re: How To Remove Automatic Date....
    ... See How to Find & ReplaceAll on a Batch of Documents in the Same Folder ... "Bright Spark" wrote in message ... >>> I've tried removing all formatting, etc., but I'm just not coming up ...
    (microsoft.public.word.newusers)
  • Re: VideoRedo - Batch processing procodure?
    ... I still think trying to use the batch function for this is more ... I would copy the VIDEO_TS folder ... something like "Unlike normal video editing, batch processing first ... when almost finished at about 9 mins it started revising its ...
    (rec.video.desktop)
  • Re: Copy files
    ... Dim rng as range ... Dim past_dest as string ... archive for scheduler / batch processing -> there are many nearly for ... the folder which the files are in is called Industry ...
    (microsoft.public.excel.misc)