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.
In reply to Re: number of files in directory - one liner
by jmcnamara
in thread number of files in current directory - one liner
by particle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |