1.

Solve : Check whether a file is empty or not?

Answer»

Hi. How can I check whether a file is empty or not?

My execution of the next statement depends on this.
It seems to be simple but I am stuck on it.
I have tried searching this in the previous posts but haven't been able to FIND this.If you check a file with Windows Explorer, in Details mode, it will tell you exactly the size of the file.....even Zero ( 0 ) files.

This is almost too obvious. I GUESS I'm not FULLY understanding your question.
Please re-state, why you can't see the size of a file.

Shadow Oh Crap. I forgot to mention. I want to find the size of the file in a batch program.

Sorry about that!!REPLACE zero.txt with the NAME of your file:

Code: [Select]@echo off
for /f "delims=" %%a in ('dir zero.txt /s /b') do (
if %%~za==0 ....
)

The dots represent your logic when you find the file has zero bytes. There are probably other ways to do this but this just popped into my head.

Good luck. Perfect. Thanks again sidewinder.



Discussion

No Comment Found