Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Welcome to the Monastery
 
PerlMonks  

Re: how to get total numbers of files in a directory?

by delirium (Chaplain)
on Dec 09, 2003 at 08:43 UTC ( [id://313409]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to how to get total numbers of files in a directory?

This code should do what you want:

perl -le 'print scalar @{[</home/a/*.txt>]}'

Welcome to the forum!

Replies are listed 'Best First'.
Re: Re: how to get total numbers of files in a directory?
by flounder99 (Friar) on Dec 09, 2003 at 10:53 UTC
    Watch out for dirctories ending in .txt
    $ touch temp.txt $ mkdir dir.txt $ perl -le 'print scalar @{[<./*.txt>]}' 2
    Try this:
    $ perl -le 'print scalar @{[grep {-f} <./*.txt>]}' 1

    --

    flounder

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://313409]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.