Exforsys
+ Reply to Thread
Results 1 to 5 of 5

Shell Program to count files directories

This is a discussion on Shell Program to count files directories within the Shell Programming forums, part of the Operating Systems category; Hi , Can any body suggest me how to write a shell program to for displaying directory and file count ...

  1. #1
    jennifer99 is offline Junior Member Array
    Join Date
    Jun 2005
    Answers
    3

    Shell Program to count files directories

    Hi ,
    Can any body suggest me how to write a shell program to for displaying directory and file count in the current directory.

    Thnx& Regards


  2. #2
    gkpruthi is offline Junior Member Array
    Join Date
    Jul 2005
    Location
    Chandigarh
    Answers
    1
    ls -l |wc -l


  3. #3
    jennifer99 is offline Junior Member Array
    Join Date
    Jun 2005
    Answers
    3

    Sorry You mistook me

    Hi pruthi,
    I am not trying to print the no of files and directories together . But I need their count seperately.
    Example :
    If I have 10 ordinary files , 5 special files , 3 direcories etc. I should get their count seperately. I did this earlier but forgat the logic

    Any way thanks for the reply.

    Thnx & regards


  4. #4
    david is offline Junior Member Array
    Join Date
    Sep 2005
    Answers
    1
    find / -name "*" -type f | wc -l


  5. #5
    psiva_exforsys is offline Junior Member Array
    Join Date
    Jun 2007
    Answers
    8

    How to count files directorys

    The below command used to count the fikes and directorys

    ls -rtl | wc -r | grep "^-r" --> for count the files.

    ls -rtl | wc -c | grep "^-d" --> for count the directorys.


    Regards,
    Siva.P

    Last edited by psiva_exforsys; 06-25-2007 at 06:10 AM.

    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...