How do I tell when a directory is empty in a script?

Steve Gombosi sog at bierstadt.scd.ucar.edu
Tue Apr 2 04:35:12 AEST 1991


`ls $dir|wc -l` doesn't always work.

A straight "ls" won't catch the existence of "hidden" files (i.e., files
whose name begins with "."). You could have megabytes worth of such files
and STILL think the directory was empty.

You have to use the -a option to see these files.



More information about the Comp.unix.questions mailing list