Re: Determining the number of files in a directory
On Sat, 2007-11-03 at 12:49 +, Daniel Bye wrote: > On Sat, Nov 03, 2007 at 12:41:51PM +, Daniel Bye wrote: > > On Sat, Nov 03, 2007 at 05:27:06AM -0700, White Hat wrote: > > > This is probably a dumb question; however, I never let a little thing > > > like > > > that bother me in the past. > > > > Heheh! You and many more, my friend, myself absolutely included! > > > > > Using FreeBSD-6.2 and Bash, how do I determine the number of files in a > > > given directory? I have tried all sorts of combinations using different > > > flags with the 'ls' command; however, none of them displays the number of > > > files in the directory. > > > > $ ls | wc -l > > > > will show you how many files and directories in the current (target) > > directory. To count just files, and exclude directories, you could try > > something like > > > > $ find /target/directory -type f -print | wc -l > > Except of course, that would descend into the subdirectories you're trying > not to count... Sorry - an object lesson in not hitting send before you've > tested what you scribbled. $ find /target/directory -maxdepth 1 -type f -print | wc -l should do what you want though. > > Dan > signature.asc Description: This is a digitally signed message part
Booting with a MFS filesystem
I'm trying to boot from a flash with the file system loaded into an MFS filesystem. This is what the /boot/loader.rc looks like: --- load /kernel load -t mfs-root /mfsroot autoboot 0 --- The flash boot partition contains these files / kernel.gz mfsroot.gz boot/ loader loader.rc I managed to get this to work the other day, by constructing the file systems for the flash "by hand", but now I'm suddenly stumped when trying to rebuild. Loading and starting the kernel works ok, but after initial boot, this happens: ... sio0: type 16550A, console sio1 at port 0x2f8-0x2ff irq 3 on isa0 sio1: type 16550A ad0: 245MB [980/16/32] at ata0-master BIOSPIO Manual root filesystem specification: : Mount using filesystem eg. ufs:/dev/da0s1a ? List valid disk boot devices Abort manual input mountroot> Obviously it doesn't like to mount the MFS as root, but so far I haven't been able to figure out exactly why. The MFS was constructed basically like this: dd if=/dev/null of=mfsroot ... vnconfig -e -s labels vn2 mfsroot disklabel -w -B -b boot1 -s boot2 vn2 auto newfs -o space -m 1 /dev/vn2c # mount and populate This is more or less what /usr/src/release/scripts/doFS.sh does, I've mimicked the way the boot floppy works. Selected parts from the kernel config file: options FFS #Berkeley Fast Filesystem options FFS_ROOT#FFS usable as root device [keep this!] options SOFTUPDATES #Enable FFS soft updates support options MFS #Memory Filesystem options MD_ROOT #MD is a potential root device pseudo-device md # Memory "disks" Anyone have any obvious things I must have missed? -- Daniel Larsson Service Factory AB Årstaängsvägen 17 Phone: +46 70 559 41 61 signature.asc Description: This is a digitally signed message part