Date: Thu, 18 May 2000 12:37:40 +0200 From: "Dan Larsson" <dl@tyfon.net> To: <questions@freebsd.org> Subject: Howto determine if directory is empty Message-ID: <NEBBJANJCNNAKCPFKHHFCELOCDAA.dl@tyfon.net>
next in thread | raw e-mail | index | archive | help
I'm currently using this: if [ -d $mydir -a `cd $mydir; ls -la | wc -l | awk '{print $1}'` -eq 2 ] then echo 'empty' else echo 'not empty (or not a directory)' fi Is there a better way ( preferrably shorter ) to do it? Regards ------------ Dan Larsson To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?NEBBJANJCNNAKCPFKHHFCELOCDAA.dl>