Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-17-2010, 04:33 PM   PM User | #1
gr85z
New to the CF scene

 
Join Date: Dec 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
gr85z is an unknown quantity at this point
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.
gr85z is offline   Reply With Quote
Old 12-17-2010, 06:19 PM   PM User | #2
bazz
Master Coder

 
Join Date: Apr 2003
Location: in my house
Posts: 5,211
Thanks: 39
Thanked 201 Times in 197 Posts
bazz will become famous soon enoughbazz will become famous soon enough
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
bazz is offline   Reply With Quote
Old 12-20-2010, 02:22 PM   PM User | #3
gr85z
New to the CF scene

 
Join Date: Dec 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
gr85z is an unknown quantity at this point
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
gr85z is offline   Reply With Quote
Old 12-20-2010, 03:18 PM   PM User | #4
bazz
Master Coder

 
Join Date: Apr 2003
Location: in my house
Posts: 5,211
Thanks: 39
Thanked 201 Times in 197 Posts
bazz will become famous soon enoughbazz will become famous soon enough
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
bazz is offline   Reply With Quote
Old 12-20-2010, 06:21 PM   PM User | #5
gr85z
New to the CF scene

 
Join Date: Dec 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
gr85z is an unknown quantity at this point
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
gr85z is offline   Reply With Quote
Old 12-20-2010, 06:57 PM   PM User | #6
FishMonger
Super Moderator


 
Join Date: May 2005
Location: Southern tip of Silicon Valley
Posts: 2,757
Thanks: 2
Thanked 149 Times in 144 Posts
FishMonger will become famous soon enoughFishMonger will become famous soon enough
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.
FishMonger is offline   Reply With Quote
Reply

Bookmarks

Tags
calculation., directory, perl, sizes

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:53 PM.


Advertisement
Log in to turn off these ads.