The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Create individual tgz files from a set of files amitg UNIX for Dummies Questions & Answers 4 04-29-2008 06:13 AM
Script that can Copy a Range of files from Tape to Hard disk msjazzie Shell Programming and Scripting 0 08-13-2007 12:47 PM
Mail Files Script earnstaf Shell Programming and Scripting 6 07-05-2007 01:42 PM
Line Count & MAil Issues Remi UNIX for Dummies Questions & Answers 3 12-02-2006 07:15 PM
find files older than 30mins,count and send mail kayarsenal Shell Programming and Scripting 4 09-27-2006 11:11 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-14-2008
Registered User
 

Join Date: Feb 2008
Posts: 9
Stumble this Post!
Script to count files and get the disk usgae on individual mail folders

I have several mail accounts using dovecot maildr format for which I'd like to create a script so that when I run it, for each user it prints not only the name of the user but all of the folders contained and outputs each of the names of the folders created by the user (including the default cur, new, tmp dirs) with a wc on the number of files in each and du consumed by that folder.

Here's a general run down of how the dir structure is..
$ pwd
/stats/mail
$ ls -lAh
total 3
drwx------ 5 473177 client 512B May 14 07:55 .jklein
drwx------ 5 473177 client 512B Feb 22 19:41 .pow103
drwx------ 5 473177 client 512B Aug 4 2007 .test
$ cd .test
$ ls -lah
total 6
drwx------ 5 473177 client 512B Aug 4 2007 .
drwx------ 5 473177 client 512B Aug 4 2007 ..
drwx------ 2 473177 client 512B Aug 4 2007 cur
-rw------- 1 473177 client 37B Aug 4 2007 dovecot-uidlist
drwx------ 2 473177 client 512B Aug 4 2007 new
drwx------ 2 473177 client 512B Aug 4 2007 tmp
$ cd cur
$ ls -lah
total 5
drwx------ 2 473177 client 512B Aug 4 2007 .
drwx------ 5 473177 client 512B Aug 4 2007 ..
-rw------- 1 473177 client 1K Feb 18 2005 1108726486.Q00001.v
$ du -khd 1
2.0K .

I'd like it to output the information in a user friendly format so a script that just captures these variables is enough for me:
$UsrA
$UsrAFldrAmsgnumb
$UsrAFldrAsize
$UsrAFldrBmsgnumb
$UsrAFldrBsize
$UsrB
$UsrBFldrAmsgnumb
$UsrBFldrAsize
$UsrBFldrBmsgnumb
$UsrBFldrBsize
$UsrC
$UsrCFldrAmsgnumb
$UsrCFldrAsize
$UsrCFldrBmsgnumb
$UsrCFldrBsize

And so on and so forth with the amt of users and sub folders being dynamic. Thanks in advance for your help.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-17-2008
Registered User
 

Join Date: Feb 2008
Posts: 9
Stumble this Post!
I know the commands It would just be convenient if the same commands to get the information could be done in a way where I can type a one liner and have all of the data outputted for all the accounts. Again, any help I'd appreciate.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:57 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0