Directoy Size - avoid cannot read directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Directoy Size - avoid cannot read directory
# 1  
Old 09-27-2013
Directoy Size - avoid cannot read directory

Hello,

I need to write a script to check directory size on a linux server.

I do not have access to some directories Inside the directory tree so I've got some warning in the output that say :

Code:
du : cannot read directory ....

Could you please help me. I did try Inside of my script to use :
Code:
grep -v "du : cannot read directory "

but that doesn't work.

the output needed have to be :

Code:
size : path

Thank for your help
# 2  
Old 09-27-2013
Hi, May i know how do you use that grep, please.
did you use like:
Code:
du | grep -v "du : cannot read directory "

# 3  
Old 09-27-2013
Code:
du 2>/dev/null

should do the trick
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

One directory, extracting only files to a new directoy

I need a hint for extracting and copying only the loads of .mp3 files from one directory and its subdirectories to get them all into only one directory. This way I am doing gives me a identical copy with hundreds of subdirectories. But I just don't get it to extract only the files. Though I tried... (9 Replies)
Discussion started by: 1in10
9 Replies

2. Shell Programming and Scripting

How can we automaitcally sync/copy files from one directoy to another ?

Hi, I would like to achieve below requirement, I have a directory "/mydir" and I want to automatically sync/copy all the content of /mydir directory to "/yourdir" directory all the time. meaning, if some application creates a file in /mydir, it supposed to be copied/available in "/yourdir"... (4 Replies)
Discussion started by: aaron8667
4 Replies

3. UNIX for Dummies Questions & Answers

Ls directory size reporting byte size instead of file count

I have been searching both on Unix.com and Google and have not been able to find the answer to my question. I think it is partly because I can't come up with the right search terms. Recently, my virtual server switched storage devices and I think the problem may be related to that change.... (2 Replies)
Discussion started by: jmgibby
2 Replies

4. Shell Programming and Scripting

How to avoid TAR of directory with no permissions?

Hi Users, i have a situation as below; -rw-r--r-- 1 t1elkpe cmptl 0 Mar 18 12:00 file2 ---------- 1 t1elkpe cmptl 0 Mar 14 16:07 file1 d--------- 3 t1elkpe cmptl 3 Mar 18 11:23 fd now when i am tarting the above files below is what i get as... (10 Replies)
Discussion started by: rajangupta2387
10 Replies

5. Shell Programming and Scripting

How to delete some of the files in the directory, if the directory size limits the specified size

To find the whole size of a particular directory i use "du -sk /dirname".. but after finding the direcory's size how do i make conditions like if the size of the dir is more than 1 GB i hav to delete some of the files inside the dir (0 Replies)
Discussion started by: shaal89
0 Replies

6. Shell Programming and Scripting

Script to read file size and send email only if size > 0.

Hi Experts, I have a script like $ORACLE_HOME/bin/sqlplus username/password # << ENDSQL set pagesize 0 trim on feedback off verify off echo off newp none timing off set serveroutput on set heading off spool Schemaerrtmp.txt select ' TIMESTAMP COMPUTER NAME ... (5 Replies)
Discussion started by: welldone
5 Replies

7. UNIX for Dummies Questions & Answers

directory tree with directory size

find . -type d -print 2>/dev/null|awk '!/\.$/ {for (i=1;i<NF;i++){d=length($i);if ( d < 5 && i != 1 )d=5;printf("%"d"s","|")}print "---"$NF}' FS='/' Can someone explain how this works..?? How can i add directory size to be listed in the above command's output..?? (1 Reply)
Discussion started by: vikram3.r
1 Replies

8. Solaris

Directory size larger than file system size?

Hi, We currently have an Oracle database running and it is creating lots of processes in the /proc directory that are 1000M in size. The size of the /proc directory is now reading 26T. How can this be if the root file system is only 13GB? I have seen this before we an Oracle temp file... (6 Replies)
Discussion started by: sparcman
6 Replies

9. UNIX for Dummies Questions & Answers

Searching a directoy

Hi, How to search a directory and know it's path. Please Help. Thanks (3 Replies)
Discussion started by: gumsun
3 Replies
Login or Register to Ask a Question