|
FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
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: Code:
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. 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 |
|
|||
Quote:
Code:
$ ls -l | grep ^d |
|
|||
I think I just wasted two semesters trying to get to know C++, boost, etc. When those forums give you a hint your on your own for any other week/month/years, with-out a clue writing a full-blown program for what these one-liners already did/done/case-close ...
There are no directories in /rescue but both will output [1] *OR* always output one extra to a count if called with-in a directory or sub-directory. It add a count of one for itself. I can live with that Code:
find /rescue -type d -print | wc -l Code:
find /rescue/ -type d -print | wc -l If you call this a hint what could possibly works better? Or is it the new FreeBSD current? Code:
$ ls -l | grep ^d Thanks guys |
|
|
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 |