Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with perl script

    OK to start this is not homework just a play around script for work.
    Here is what I need to do. I have a simple text file with directories listed in it. the directories are broken into 4 sections.
    Ex.
    #Section 1
    /blah1/blah/

    #Section 2
    /halb2/hlab
    ........

    I need to read each section and get a total space used of the directories listed. There will be directories not listed so that will be the others.

    The requirements I need is to
    A. Know the total size of volume I am working with
    B. Know the total size of all the directories on each section.
    C. Take the total from "B" and subtract from "A" to get "C"

    The most I have is getting directory size but only from current I know very little of perl and if some direction can be given I will start putting together and posting what I came up with I just need direction.

    Thanks in advance.

  • #2
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    to help with understanding it, can you post some lines from your text file.

    thanks

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #3
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Bazz

    I have example in post
    here is more detail if that helps

    #Section 1
    /gpfs/home/
    /gpfs/database/users

    #Section 2
    /gpfs/build
    /gpfs/database/build

    #Section 3
    /gpfs/cm
    /gpfs/database/cm

    Each section could have as many as 20 directories to look into. and total each one individually. Then taking those totals and subtracting from overall size of file system to be classified as other.

    So output would look like
    File system size = XXXXXGB
    Section 1 = xxGB
    Section 2 = xxxxGB
    Section 3 = xxGB
    Other = xxxGB

    The script would only be ran quarterly unless needed more often to see who and what is using space. We have requirements for who is allocated what for space and just want to make sure we don't have any users or builds taking more than there allocation.

    Thanks
    James

  • #4
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    so, is this the actual content of your text file?
    Code:
    #Section 1
    /gpfs/home/
    /gpfs/database/users
    
    #Section 2
    /gpfs/build
    /gpfs/database/build
    
    #Section 3
    /gpfs/cm
    /gpfs/database/cm
    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #5
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bazz View Post
    so, is this the actual content of your text file?
    Code:
    #Section 1
    /gpfs/home/
    /gpfs/database/users
    
    #Section 2
    /gpfs/build
    /gpfs/database/build
    
    #Section 3
    /gpfs/cm
    /gpfs/database/cm
    bazz
    Yes that will be the context there will be more directories within each section

  • #6
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,945
    Thanks
    2
    Thanked 170 Times in 165 Posts
    It's not real clear where you need help.

    Please post your code and point out (with clear details) the portion that is giving you trouble. Include any errors/warnings that it generates. That is the minimum starting point we need to be able to help you.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •