Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Finding size of all directories Post 302534846 by Peasant on Wednesday 29th of June 2011 01:48:18 AM
Old 06-29-2011
Quote:
Originally Posted by Aussiemick

---

Interesting looking code, I ran it and had no bugs, I really don't understand awk or sed but that's purely because I haven't had enough experience with them, are you able to explain your code at all?

The find line finds files and executes du -sk on each (you can also use \+ for performance gain).
The format find spits out is :
NUMERIC SIZE OF FILE IN KB, followed by a tab and file(absolute path).

sed line matches everything to the last slash with regex, matching the path without the filename.
Code:
\(/.*/\)

Then replaces it with matched regex and tab char.
Code:
 &\t

Next code just replaces space with _ for the awk to work as desired
So
Code:
4<tab>/home/user/.claws-mail/claws.log

becomes
Code:
4<tab>/home/user/.claws-mail/<tab>claws.log

Basically now file is always $NF and directory where it resides is $(NF -1)

In awk i'm still in process of learning and not much of explaining , i did wrote that by looking at other examples and trying to figure out as much as i can to achieve needed output.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

finding directories in UNIX

I am accessing a UNIX server via FTP. I want to retieve a file in a directory. What is the UNIX command that I need to view and retrieve files from a directory? (1 Reply)
Discussion started by: yodaddy
1 Replies

2. Shell Programming and Scripting

finding duplicate files by size and finding pattern matching and its count

Hi, I have a challenging task,in which i have to find the duplicate files by its name and size,then i need to take anyone of the file.Then i need to open the file and find for more than one pattern and count of that pattern. Note:These are the samples of two files,but i can have more... (2 Replies)
Discussion started by: jerome Sukumar
2 Replies

3. Shell Programming and Scripting

finding correct directories

I have directories like V00R01,V00R02,V01R01,V01R02 in a directory where V is version and R is a release. basically I need to set base directory and current directory. Under a version there can be any number of releases and there can be number of versions also. V00R01...V00R50..so on also,... (2 Replies)
Discussion started by: vjasai
2 Replies

4. Shell Programming and Scripting

Script for parsing directories one level and finding directories older than n days

Hello all, Here's the deal...I have one directory with many subdirs and files. What I want to find out is who is keeping old files and directories...say files and dirs that they didn't use since a number of n days, only one level under the initial dir. Output to a file. A script for... (5 Replies)
Discussion started by: ejianu
5 Replies

5. Shell Programming and Scripting

Finding directory and sub-directories individual size in Perl

Hi, Can anyone redirect to an existing thread or provide some info on how to find the size of a directory and it's sub-directories using a single script ? I tried finding a similar thread but in vain. I'm a newbie and any help would be greatly appreciated. Thanks in advance. (3 Replies)
Discussion started by: ryder
3 Replies

6. Shell Programming and Scripting

Finding directories older than 5 days

Hello, Motive: Search all directories which are older than 5 days. Example: consider following directory structure: abc/dir1 abc/dir1/dir abc/dir2 abc/dir3 abc/dir3/temp Suppose dir1 and dir3 are 5 days older. Then I am looking for a command which lists abc/dir1 and abic/dir3 only so that... (4 Replies)
Discussion started by: mytempid07
4 Replies

7. Shell Programming and Scripting

How to list all the directories, sub directories in a mount along with size in ascending order?

Hi , I am very new to unix as well as shell scripting. I have to write a script for the following requirement. In a particular mount, have to list all the directories and sub directories along with size of the directory and sub directory in ascending order. Please help me in this regard and many... (4 Replies)
Discussion started by: nmakkena
4 Replies

8. UNIX for Dummies Questions & Answers

[Solved] Finding the Files In the Same Name Directories

Hi, In the Unix Box, I have a situation, where there is folder name called "Projects" and in that i have 20 Folders S1,S2,S3...S20. In each of the Folders S1,S2,S3,...S20 , there is a same name folder named "MP". So Now, I want to get all the files in all the "MP" Folders and write all those... (6 Replies)
Discussion started by: Siva Sankar
6 Replies

9. UNIX for Dummies Questions & Answers

Finding multiply directories

I have multiply directories scattered throughout my system that end in 2011. Example: one_2011 two_2011 three_2011 etc.... I'm trying to find all of these directories but coming up short. I tried find / -type d -name *2011 > example Any suggestions? I already searched in the... (13 Replies)
Discussion started by: shorty
13 Replies

10. Shell Programming and Scripting

Finding directories with expression

Hi All, I need your help in finding pattern of directories. need to search for all pattern have "mypatern" from base directory folder. example ------- server1 - base directory 100 server1/ab_123456_1/mypattern 100 server1/ab_123456_2/mypattern 200 server1/ab_123457_1/mypattern... (13 Replies)
Discussion started by: lxdorney
13 Replies
CLAWS-MAIL-BOGOFIL(1)					   CLAWS-MAIL-BOGOFILTER Manual 				     CLAWS-MAIL-BOGOFIL(1)

NAME
claws-mail-bogofilter - Scanning mails for spam with Bogofilter. DESCRIPTION
This manual page documents briefly the claws-mail-bogofilter plugin. This manual page was written for the Debian distribution because the original program does not have a manual page. claws-mail-bogofilter is a plugin (loadable module) for the Claws Mail mailer. This plugin allows scanning incoming mails using bogofilter to decide if they are spam or not. Bogofilter can also be teached to recognise spam or ham messages with the corresponding menu entries. USAGE
Before using a plugin you must instruct Claws Mail to load it on startup. For this you must go "Configuration" menu on main window toolbar, open "Plugins..." dialog, click on the "Load plugin..." button and select the plugin file, named bogofilter.so, and press the "Open" button. FILES
/usr/lib/claws-mail/plugins/bogofilter.so The loadable module for claws-mail-bogofilter. BUGS
Please use reportbug claws-mail-bogofilter for reporting Debian bugs for this package. The upstream BTS can be found at http://www.thewildbeast.co.uk/claws-mail/bugzilla/index.cgi. SEE ALSO
bogofilter(1), claws-mail(1), claws-mail-extra-plugins(1) AUTHORS
Colin Leroy <colin@colino.net> Wrote the claws-mail-bogofilter plugin. Ricardo Mones <mones@debian.org> Wrote this manpage for the Debian system. COPYRIGHT
Copyright (C) 2008 Ricardo Mones This manual page was written for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 or (at your option) any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. claws-mail-bogofilter September, 2008 CLAWS-MAIL-BOGOFIL(1)
All times are GMT -4. The time now is 03:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy