in reply to number of files in current directory - one liner


That's nice.

However, readdir() requires that you either chdir() or prepend the path. So you would have to do something like this: perl -le'$d=pop;opendir(D,$d)||die$!.$/;print~~grep{-f"$d/$_"}readdir D' dir

Or for just the current dir: perl -le'opendir D,".";print~~grep{-f}readdir D'

--
John.

Replies are listed 'Best First'.
Re: Re: number of files in directory - one liner
by particle (Vicar) on Mar 27, 2002 at 16:38 UTC
    you are correct. mine will work fine for the current directory, but give invalid results elsewhere. i'll update my code a bit.

    ~Particle ;Þ