Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 29th April 2011
sharris sharris is offline
Package Pilot
Join Date: Jun 2010
Posts: 146
Default How-To get a directory count

Hello everybody!

I did a search and finally found out how to get the file count in various ways with-in a direcory. These works very well on FreeBSD current-9.0:

 ls | wc -l  #  count files and one for each directories in the current (target) directory.

find /target/directory -type f -print | wc -l    # count all files in all directories, but exclude directories count

find /target/directory -maxdepth 1 -type f -print | wc -    #  all files, in given directory only.
... but I found nothing about how-to get a count of directories only with-in a directory.

My questions is:

1) How do we get the count of all directories only with-in a directory.

2) and than how to get a list of all directory names with-in a given directory.

Thanks in advance
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How is SSL hopelessly broken? Let us count the ways J65nko News 0 12th April 2011 01:17 AM
Xtracting Data after Fragmentation / Block Count / Partition Problems on Boot IronForge OpenBSD Installation and Upgrading 3 16th December 2010 01:09 AM
FreeBSD 7.2@amd64 atheros problem ath0: stuck beacon; resetting (bmiss count 4) asmo FreeBSD General 0 6th June 2009 11:02 AM
strange "~" directory in home directory gosha OpenBSD General 5 23rd February 2009 06:12 PM
how to copy a directory. bsdnewbie999 OpenBSD General 1 12th July 2008 02:36 PM

All times are GMT. The time now is 05:31 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick