Jayjan jay!! Don't use find with exec unless you have to do stuff inside the exec!
Replace with : ---------- Post updated at 07:16 PM ---------- Previous update was at 06:59 PM ----------
@ajaypatil_am
Here's what you can do: find all the dirs in depth-first order, then feed each dir into du.
Here's what we're doing: The find gets all the directories (your target dir is $DIR) and prints them out one line at a time. The awk command then prints out each directory name followed by its depth -- determined by the number of times split found the / character in the input line. We separate the fields by tabs to prevent long and unusual dir names from getting clobbered by the next steps. Next, sort orders the list by directory depth. Now that the list is ordered, we dont need the depth information anymore, so the cut command strips it (you can also do this with awk or sed). Finally, the resulting list is fed into xargs, which prints out and executes the command "du -sh" on each directory, one directory at a time.
The output is then sent through your $PAGER, which ought to be defined. If not, use "less" or "more" whichever works for you.
This way, you can find a particularly large directory without waiting forever for the job to finish.
Last edited by otheus; 12-20-2011 at 02:27 PM..
Reason: solaris compat edits
Hi everyone,
I need to write a script to calculate the space for sub-folders under /home:
Here is the scanrio:
cd /home
drwxr-xr-x 57 root root 8192 Jan 22 16:13 home_1
drwxrwxrwx 69 root root 8192 Jan 29 10:36 home_2
drwxr-xr-x 97 root root 8192 Nov... (8 Replies)
I am looking to delete files that are of a certain age with something like the following...
find /directory -type f -mtime +14 | xargs rm
....however, I would like to only execute this on the current directory and not subdirectories.
Any ideas? (4 Replies)
OK I am trying to use something similar to this:
#!/bin/sh
echo "OK, starting now..."
sftp -b /dev/fd/0 user@remotehost <<EOF
cd pub
ascii
put filename.txt
bye
EOF
only difference is the dir I need to cd to has a space in it like this
/Import/Server/Prospect File
,... (3 Replies)
Greetings!
I have multiple files, one per subdirectory, all with the same file name. All subdirectories are one level deep from the main directory.
The data in the files is tab delimited between fields and record delimited with a newline.
The subdirectory names have the date in the... (5 Replies)
Good afternoon! Im new at scripting and Im trying to write a script to
calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Hi,
I have one dir which has N subdirs.For ex:
/home/user/Project_Src
/home/user/Project_Src/Dir_A
/home/user/Project_Src/Dir_A/subdir/sub_dir2
/home/user/Project_Src/Dir_A/subdir/sub_dir3
/home/user/Project_Src/Dir_B
/home/user/Project_Src/Dir_B/Build
i want to create a folder with... (2 Replies)
Hello Comunity
I am trying to make a bash shell script that it copies files and subdirs(with files) to a new dir. I would like the dest_dir to contain only subdirectories with files not other subdirs inside.
it called : cpflatdir src_dir dest_dir
Pleaze help me!
Thank you in... (2 Replies)
Hi,
I would like to list all files, older than 7 days, in a directory, but exclude all subdirectories in the find command. If I use find . -type f -mtime +7 all files in the subdirs are also included. How can I exclude them?
Regards,
JW (6 Replies)
I have a script that I am trying to use. I need it to run from a certain directory. I have tried the following:
SCRIPT_DIR=$PWD
MYDIR="/filemount/files/Move Files"
cd "$MYDIR"
$SCRIPT_DIR/movefiles.bash
I have tried to run it. but I always get "no such file or directory" from the script... (5 Replies)
Hi
I am trying to run a script in a sub-directory, that has one space on it: such as:
/internaldisk1/Task Logs1, but my entry in cron is not working:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /internaldisk1/Task\ logs1/./remov_reject.sh > /var/tmp/interd_`date '+%Y%M%d'`.log 2>&1 Please can... (4 Replies)
Discussion started by: fretagi
4 Replies
LEARN ABOUT OSF1
fs_quota
FS_QUOTA(1) AFS Command Reference FS_QUOTA(1)NAME
fs_quota - Displays the quota used in the volume containing a directory or file
SYNOPSIS
fs quota [-path <dir/file path>+] [-help]
fs q [-p <dir/file path>+] [-h]
DESCRIPTION
The fs quota command displays the percent of quota consumed in the volume that contains each specified directory or file.
To display more detailed information about the volume and the partition it resides on, use the fs examine and fs listquota commands.
To set volume quota, use the fs setquota or fs setvol command.
CAUTIONS
Currently, the maximum size of a volume is 2 terabytes (2^31 bytes).
OPTIONS -path <dir/file path>
Names each file or directory for which to display the quota consumed in its parent volume. Partial pathnames are interpreted relative
to the current working directory, which is also the default value if this argument is omitted.
-help
Prints the online help for this command. All other valid options are ignored.
OUTPUT
The output reports the percent of volume quota used, in the following format:
<percent>% of quota used.
EXAMPLES
The following command lists the percent quota used of the volume housing the current working directory:
% fs quota
17% of quota used.
The following command lists the percent quota used of both the volume housing the current working directory's parent directory and the
volume housing the directory /afs/abc.com/usr/smith:
% fs quota -path .. /afs/abc.com/usr/smith
43% of quota used.
92% of quota used.
PRIVILEGE REQUIRED
The issuer must have the "r" (read) permission on the ACL of the root directory of the volume that houses the file or directory named by
the -path argument, and "l" (list) permission on the ACL of each directory that precedes it in the pathname.
SEE ALSO fs_examine(1), fs_listquota(1), fs_setquota(1), fs_setvol(1)COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.
This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas
Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.
OpenAFS 2012-03-26 FS_QUOTA(1)