The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


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


Other UNIX.COM Threads 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 Search this Thread Display Modes
  #1 (permalink)  
Old 05-14-2008
Registered User
 

Join Date: Feb 2008
Posts: 2
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl 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: 2
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl 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 UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 11:21 PM.


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

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102