Dos type command to test for zero-length file

  • Thread starter Thread starter C C
  • Start date Start date
C

C C

Hello.

Is there a program to be run in a dos prompt to test for a zero-length file?
The result can be through errorlevel or by creating a result in the
environment variable, or into a file.

Thanks in advance.
 
C C said:
Hello.

Is there a program to be run in a dos prompt to test for a zero-length file?
The result can be through errorlevel or by creating a result in the
environment variable, or into a file.

Thanks in advance.

DOS can't do this (because DOS is an ancient operating system
with rather limited capabilities) but the Command Prompt under
Windows can:

@echo off
for %%a in (c:\temp.txt) do echo The size of c:\temp.txt is %%~za bytes.
 
You should be able to use the Windows Script Model (.wsh) or Visual Basic
Script (.vbs), which both have an equivalent 'isempty' function as part of
their repetroire.
 
Thanks. This helps a lot with my automation of exporting an EDI received
file from a front-end PC platform to our AIX box. If the export file is
empty (or zero-length), the routine to ftp the file to the AIX box will not
be performed.
 
Thanks. I have a dos style batch script to process EDI received files from
a front-end PC platform to our AIX box. If the file is empty, the ftp
command will not be performed.

I have read and adopted Pegasus' suggestion.
 
Back
Top