From owner-freebsd-questions Thu May 18 3:36:11 2000 Delivered-To: freebsd-questions@freebsd.org Received: from hq1.tyfon.net (hq1.tyfon.net [213.212.29.17]) by hub.freebsd.org (Postfix) with ESMTP id 9929337B982 for ; Thu, 18 May 2000 03:36:01 -0700 (PDT) (envelope-from dl@tyfon.net) Received: from enigmatic (dan [192.168.1.20]) by hq1.tyfon.net (Postfix) with SMTP id 7F6051C5C9 for ; Thu, 18 May 2000 12:35:59 +0200 (CEST) From: "Dan Larsson" To: Subject: Howto determine if directory is empty Date: Thu, 18 May 2000 12:37:40 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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