Loading ...
Sorry, an error occurred while loading the content.

Stat & Glob ?

Expand Messages
  • Gordon Stewart
    Hi there... Is there a way to combine stat & glob - or a 3rd function / process ? Without globbing a directory, & finding a list of *.txt files.. & then
    Message 1 of 2 , Aug 3, 2003
    • 0 Attachment
      Hi there...

      Is there a way to combine stat & glob - or a 3rd function / process ?

      Without globbing a directory, & finding a list of *.txt files.. & then
      looping through the list, & doing a stat on each one ?

      or is that the only way ?

      IE - Ive got a directory, & wish to find out how much disk space the files
      are using, in total..


      G
    • Damien Carbery
      ... process ? ... then ... the files ... I wrote a script to look at ALL files in a directory tree and add up the sizes. I even got it to display human
      Message 2 of 2 , Aug 4, 2003
      • 0 Attachment
        --- In perl-beginner@yahoogroups.com, Gordon Stewart <gordon52@s...>
        wrote:
        >
        > Hi there...
        >
        > Is there a way to combine stat & glob - or a 3rd function /
        process ?
        >
        > Without globbing a directory, & finding a list of *.txt files.. &
        then
        > looping through the list, & doing a stat on each one ?
        >
        > or is that the only way ?
        >
        > IE - Ive got a directory, & wish to find out how much disk space
        the files
        > are using, in total..
        >
        >
        > G

        I wrote a script to look at ALL files in a directory tree and add up
        the sizes. I even got it to display 'human readable' sizes (like 'ls -
        lh' or 'df -kh') with K, M and G (for KB, MB and GB of course).
        It could be easily modified to permit specifying certain file types.

        I used File::Find and the '-s' operator.

        If you want the size of a directory tree on Unix you can use 'du'.
      Your message has been successfully submitted and would be delivered to recipients shortly.