Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Skipping empty directories

1 view
Skip to first unread message

l...@bounceit.net

unread,
Sep 3, 2001, 9:39:06 AM9/3/01
to
I asked this question a while back and got some good answers but after
implementing what looked like the most straightforward I find it is not
working properly so...

I have a batch file that lists the contents of several directories to a
text file:

Dir ..\abc >> f:my.txt
Dir ..\def >> f:my.txt
Dir ..\ghi >> f:my.txt

IF the directories are empty I have extra stuff I do not want (it is
printed later). What I am looking for is a simple way to not even
execute the dir command if the directory is empty (they all do exist).

TIA

LB

Frank-Peter Schultze

unread,
Sep 3, 2001, 3:57:24 PM9/3/01
to
l...@bounceit.net wrote in message news:<3B9387FA...@nac.net>...

Dir /A-D

returns errorlevel 1 if current directory contains 0 file(s).

How about...

Dir ..\abc /A-D >NUL 2>&1 && Dir ..\abc >> f:my.txt
:
:

HTH

--
Frank-Peter Schultze <fpsch...@my-deja.com>, http://www.fpschultze.de

l...@bounceit.net

unread,
Sep 6, 2001, 10:10:30 PM9/6/01
to

Thanks

Will try ASAP

LB

0 new messages