Sponsored Content
Full Discussion: Directories sizes
Top Forums UNIX for Dummies Questions & Answers Directories sizes Post 302356427 by methyl on Friday 25th of September 2009 12:51:21 PM
Old 09-25-2009
The output from "find" is not sorted and also probably needs the "-xdev" switch to stop it looking at other mountpoints. Also be aware that "du" without the "-x" switch can follow links to other filesystems.
Depends what you want.

Maybe try something like this (the exact syntax depends on your O/S and version):

Code:
find . -type d -xdev -print | sort | xargs du -skx

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search directories for files with zero sizes to delete

Hi, I am trying to write a script that will use ls on a directory and list the files one at a time and their size. If the size is 0 i want it to ask me if I want to delete it (yes or no). If I say yes, I want it to delete but it won't know what the file name is just from running from the script.... (2 Replies)
Discussion started by: akeenabawa
2 Replies

2. Shell Programming and Scripting

check if multiple directories exist else create missing directories

Hi , I 'm trying to check if multiple directories exist on a server, if not create the missing ones and print " creating missing directory. how to write this in a simple script, I have made my code complex if ; then taskStatus="Schema extract directory exists, checking if SQL,Count and... (7 Replies)
Discussion started by: ramky79
7 Replies

3. 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

4. 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

5. UNIX for Dummies Questions & Answers

Using grep command to find the pattern of text in all directories and sub-directories.

Hi all, Using grep command, i want to find the pattern of text in all directories and sub-directories. e.g: if i want to search for a pattern named "parmeter", i used the command grep -i "param" ../* is this correct? (1 Reply)
Discussion started by: vinothrajan55
1 Replies

6. UNIX for Dummies Questions & Answers

Display Directories with their sizes in human readable format

Hi, I want to list all the directories present in a particular location and want to display their sizes as well. I know "ls -lh" but it doesn't show the size of the complete directory. So i want something like dir1 266 MB dir2 2 KB dir3 22 MB ... ... file1 10 Kb ..... Thanks Sarbjit (4 Replies)
Discussion started by: sarbjit
4 Replies

7. Shell Programming and Scripting

How to list all the files, directories and sub-directories in the current path except one directory?

Can anyone come up with a unix command that lists all the files, directories and sub-directories in the current directory except a folder called log.? Thank you in advance. (7 Replies)
Discussion started by: Manjunath B
7 Replies

8. UNIX for Dummies Questions & Answers

List the directories, having given pattern in the directories name, sorted by creation date

It is for HP-Unix B.11.31. Requirement: 1. List the directories, having given pattern in the directories name, sorted by creation date. Example: Directories with name "pkg32*" or "pkg33*" 2. On the output of 1. list the directories by creation date as sort order, with creation date... (2 Replies)
Discussion started by: Siva SQL
2 Replies

9. Solaris

Giving read write permission to user for specific directories and sub directories.

I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. This is for Solaris. Please help. (1 Reply)
Discussion started by: blinkingdan
1 Replies
Tree::Simple::Visitor::LoadDirectoryTree(3pm)		User Contributed Perl Documentation	     Tree::Simple::Visitor::LoadDirectoryTree(3pm)

NAME
Tree::Simple::Visitor::LoadDirectoryTree - A Visitor for loading the contents of a directory into a Tree::Simple object SYNOPSIS
use Tree::Simple::Visitor::LoadDirectoryTree; # create a Tree::Simple object whose # node is path to a directory my $tree = Tree::Simple->new("./"); # create an instance of our visitor my $visitor = Tree::Simple::Visitor::LoadDirectoryTree->new(); # set the directory sorting style $visitor->setSortStyle($visitor->SORT_FILES_FIRST); # create node filter to filter # out certain files and directories $visitor->setNodeFilter(sub { my ($item) = @_; return 0 if $item =~ /CVS/; return 1; }); # pass the visitor to a Tree::Simple object $tree->accept($visitor); # the tree now mirrors the structure of the directory DESCRIPTION
This visitor can be used to load a directory tree into a Tree::Simple hierarchy. METHODS
new There are no arguments to the constructor the object will be in its default state. You can use the "setNodeFilter" and "setSortStyle" methods to customize its behavior. setNodeFilter ($filter_function) This method accepts a CODE reference as its $filter_function argument and throws an exception if it is not a code reference. This code reference is used to filter the tree nodes as they are created. The function is given the current directory or file being added to the tree, and it is expected to return either true(1) of false(0) to determine if that directory should be traversed or file added to the tree. setSortStyle ($sort_function) This method accepts a CODE reference as its $sort_function argument and throws an exception if it is not a code reference. This function is used to sort the individual levels of the directory tree right before it is added to the tree being built. The function is passed the the current path, followed by the two items being sorted. The reason for passing the path in is so that sorting operations can be performed on the entire path if desired. Two pre-built functions are supplied and described below. SORT_FILES_FIRST This sorting function will sort files before directories, so that files are sorted alphabetically first in the list followed by directories sorted alphabetically. Here is example of how that would look: Tree/ Simple.pm Simple/ Visitor.pm VisitorFactory.pm Visitor/ PathToRoot.pm SORT_DIRS_FIRST This sorting function will sort directories before files, so that directories are sorted alphabetically first in the list followed by files sorted alphabetically. Here is example of how that would look: Tree/ Simple/ Visitor/ PathToRoot.pm Visitor.pm VisitorFactory.pm Simple.pm visit ($tree) This is the method that is used by Tree::Simple's "accept" method. It can also be used on its own, it requires the $tree argument to be a Tree::Simple object (or derived from a Tree::Simple object), and will throw and exception otherwise. The node value of the $tree argument (gotten by calling "getNodeValue") is considered the root directory from which we begin our traversal. We use File::Spec to keep our paths cross-platform, but it is expected that you will feed in a valid path for your OS. If the path either does not exist, or is not a directory, then an exception is thrown. The $tree argument which is passed to "visit" must be a leaf node. This is because this Visitor will create all the sub-nodes for this tree. If the tree is not a leaf, an exception is thrown. We do not require the tree to be a root though, and this Visitor will not affect any nodes above the $tree argument. BUGS
None that I am aware of. Of course, if you find a bug, let me know, and I will be sure to fix it. CODE COVERAGE
See the CODE COVERAGE section in Tree::Simple::VisitorFactory for more inforamtion. SEE ALSO
These Visitor classes are all subclasses of Tree::Simple::Visitor, which can be found in the Tree::Simple module, you should refer to that module for more information. AUTHOR
stevan little, <stevan@iinteractive.com> COPYRIGHT AND LICENSE
Copyright 2004, 2005 by Infinity Interactive, Inc. <http://www.iinteractive.com> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2005-07-14 Tree::Simple::Visitor::LoadDirectoryTree(3pm)
All times are GMT -4. The time now is 02:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy