Need help in finding Folder Size


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Need help in finding Folder Size
# 1  
Old 09-11-2008
Need help in finding Folder Size

Hi,
I would like to find the size of a folder. When I run the command
du -k
It is going through all the sub-folder and files and taking really much time.

Is there any command to get the complete directory size without showing the sub-folder and file size.

Appreciate your response.


Thanks!
# 2  
Old 09-11-2008
You could just add up the file sizes from ls -l?

Code:
ls -l | awk '{t+=$5}END{print t}'

# 3  
Old 09-11-2008
du (GNU at least) has a -s flag to do just that.
Otherwise see e.g. du a directory
# 4  
Old 09-11-2008
spirtle, while -s is useful, it doesn't avoid it searching through the subdirectories and adding them to the value reported, which is what the OP was asking for.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Debian

Finding out size of sub-directory

Hi, Is there a way to find out the size of a sub-directory? Eg subidrectory in main directory /data, like this : /data/solr-5.3.1. When I do a df -h /data/solr-5.3.1, it still gives the size of /data: root@L28condor:/data/solr-5.3.1# df -h . Filesystem Size Used... (1 Reply)
Discussion started by: anaigini45
1 Replies

2. Shell Programming and Scripting

Finding the maximum timestamp in a folder

I've the files in a directory in the following format having date +%Y%m%d%H YR_MNTH_2013061205 YR_MNTH_2013060107 and i need the latest file i.e; YR_MNTH_2013061205 to be moved to another folder #!/bin/ksh # Ksh 88 Version for test_time in YR* do --- done How can i achieve that !... (2 Replies)
Discussion started by: smile689
2 Replies

3. Shell Programming and Scripting

Getting folder more than 100K size

Hi , I am trying to get the folder details having size more than sme specified value and also the name of the folder should be like TEST. so 1. In the current directory search for all the folders having name like TEST 2. Print the list of the folder names having size more than 100... (3 Replies)
Discussion started by: Anupam_Halder
3 Replies

4. Shell Programming and Scripting

finding max size

Hi I have a list of 2000 records with multiple entries and I want to get the max size for each entry ABC 1 ABC 2 ABC 3 ABC 4 DEF 1 DEF 2 DEF 2 DEF 2 DEF 2 ... (9 Replies)
Discussion started by: Diya123
9 Replies

5. Solaris

Need to know the users folder size

Hi Forum, I need to know the size of some user home folders. I've exported an account list from an Active Directory and wrote it into a file like: user_1 user_2 user... user_n and tried "du -sh < filename", which doesn't work. Get no results. I don't need the size of all home... (3 Replies)
Discussion started by: borsti007
3 Replies

6. UNIX for Dummies Questions & Answers

I am trying to get the total size of a folder?

I am trying to get the total size of the folder using the below command but its not working. any ideas? du -bc <foldername>/|grep total|tr -s " "|cut -d" " -f1 the output i am getting is 78996 total but i just want it to be as 78996 please help (3 Replies)
Discussion started by: classic
3 Replies

7. UNIX for Dummies Questions & Answers

size of a folder ?

hi, is possible to calculate the size of a folder using ls ? ls -s works only for files.. thanks (2 Replies)
Discussion started by: aneuryzma
2 Replies

8. Shell Programming and Scripting

script for Finding files in a folder and copying to another folder

Hi all, I have a folder '/samplefolder' in which i have some files like data0.txt, data1.txt and data2.txt. I have to search the folder for existence of the file data0.txt first and if found have to copy it to some other file; next i have to search the folder for existence of file... (5 Replies)
Discussion started by: satish2712
5 Replies

9. UNIX for Dummies Questions & Answers

Limit Folder Size

Is there a way to limit a certain folder size(e.g. Documents, Desktop)? :) (2 Replies)
Discussion started by: tisdmin
2 Replies

10. 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
Login or Register to Ask a Question