Computing.Net > Forums > Windows 2000 > need to delete 0 byte files

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.

need to delete 0 byte files

Reply to Message Icon

Name: User9987
Date: October 17, 2006 at 02:50:48 Pacific
OS: w2k
CPU/Ram: non relevant
Product: non relevant
Comment:

I was looking for a script to delete 0 byte files from the command line ...

The reason for that is that I then can do a check with "if exist FILE" to determine success or not.

If sees a zero-byte file as a file, and hence cannot make a difference between a non-empty and an empty file ...

User



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: October 17, 2006 at 04:49:42 Pacific
Reply:

No idea what your 2nd and 3rd paragraphs are driving at. But this should take care of deleting 0 length files.

::== Z2.bat
@echo off
for /f "tokens=* delims=" %%F in ('dir /s/b/a-d \temp') do (
if 0 equ %%~zF echo del "%%F"
)



=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 2
Name: User9987
Date: October 18, 2006 at 05:55:33 Pacific
Reply:

C:\Tools>for /f "tokens=* delims=" %F in ('dir /s/b/a-d \temp') do (
Syntax error

C:\Tools>if 0 equ %~zF echo del "%F"
Syntax error

C:\Tools>)
Bad command or file name

Lots of errors there. The reason is that I generate tempfile, some of them are empty, some are not. I want to see the diff between them, so I delete the 0 byte files, then check on existance.

User


0

Response Number 3
Name: Mechanix2Go
Date: October 19, 2006 at 02:26:52 Pacific
Reply:

It won't work at the prompt.


=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 4
Name: User9987
Date: October 20, 2006 at 13:20:41 Pacific
Reply:

This was output from an echo-enabled batch file ... I guess W98 is different after all.

User


0

Response Number 5
Name: Mechanix2Go
Date: October 21, 2006 at 01:15:22 Pacific
Reply:

98 runs on DOS. NT is a completely different OS.


=====================================
If at first you don't succeed, you're about average.

M2



0

Related Posts

See More



Response Number 6
Name: User9987
Date: October 21, 2006 at 10:08:54 Pacific
Reply:

A changed FOR loop doesn't make an OS totally different. Unix is totally different. Windows 98, 95, NT and XP are quite compatible.

User


0

Response Number 7
Name: Mechanix2Go
Date: October 21, 2006 at 11:06:21 Pacific
Reply:

OK, if you say so.


=====================================
If at first you don't succeed, you're about average.

M2



0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Windows 2000 Forum Home


Sponsored links

Ads by Google


Results for: need to delete 0 byte files

Need to delete www.computing.net/answers/windows-2000/need-to-delete-/46241.html

Batch file to delete all the folder www.computing.net/answers/windows-2000/batch-file-to-delete-all-the-folder/37285.html

unable to delete file or folder www.computing.net/answers/windows-2000/unable-to-delete-file-or-folder/51873.html