Computing.Net > Forums > Disk Operating System > determine if a file has zero size

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

determine if a file has zero size

Reply to Message Icon

Name: earlgrey
Date: August 31, 2004 at 05:04:24 Pacific
OS: DOS
CPU/Ram: p4 512
Comment:

Does anyone know a Dos command that determines if a file has 0 kb size?
thank you




Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: August 31, 2004 at 05:51:43 Pacific
Reply:

Not a command, but a well known trick (under DOS only) is to try to copy the file; if the file has 0Kb size the copy fails and you can test for the existence of the target, if that does not exist the file's size is zero.

So e.g.

Copy Zero.ext Zero.tmp
If not exist Zero.tmp Echo Zero has 0Kb size
Del Zero.tmp

That can be embedded in a batch to achieve your target.


0

Response Number 2
Name: Mechanix2Go
Date: August 31, 2004 at 07:26:29 Pacific
Reply:

IVO,

That's slick. Does that work in 3.x - 7.x?

M2

Mechanix2Go@Golden-Triangle.com


0

Response Number 3
Name: IVO
Date: August 31, 2004 at 07:34:46 Pacific
Reply:

The trick works fine under all DOS-kernel based systems, i.e. Windows 3X/9X/ME and obviously the related DOS subsystems (DOS 7.X).


0

Response Number 4
Name: earlgrey
Date: September 1, 2004 at 00:12:22 Pacific
Reply:

that was very helpful!!! thank you!!!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: determine if a file has zero size

File Size in DOS Batch file www.computing.net/answers/dos/file-size-in-dos-batch-file/3105.html

identifying a file by date www.computing.net/answers/dos/identifying-a-file-by-date/7098.html

File size www.computing.net/answers/dos/file-size/6782.html