Automatically deleting Empty files

November 6, 2008 at 10:55:29
Specs: Windows 2003 server, 2Gb Ram ,

Apologies for this dumb question. Im a linux/unix person and have no idea on this:-(
Im hoping I can put together a shell script or something on a windows server box, which will reliably and automatically delete empty files with no content.
Im gathering records every 24 hours, which will either have a lot or no content. I want to remove the ones of no interest.

I know I can put a script execution on the windows scheduler, but the language to delete empty files, I am clueless.

Forgive me Bill Gates:-)

See More: Automatically deleting Empty files

Report •

November 8, 2008 at 13:41:03
This wil delete 0 length files in the current directory and it's subdirectories.

Before you turn this loose, be aware that some programs use 0 files as 'placekepers'.

@echo off
setLocal EnableDelayedExpansion

for /f "tokens=* delims= " %%a in ('dir/s/b/a-d') do (
if %%~Za equ 0 del %%a

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


Report •
Related Solutions

Ask Question