Getting folder more than 100K size


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Getting folder more than 100K size
# 1  
Old 04-05-2013
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 Kilobyte.


Please help.
# 2  
Old 04-05-2013
Code:
find . -type d -name "*TEST*" -size +102400c -print

# 3  
Old 04-05-2013
One way:
Code:
find . -type d -exec du -s '{}' \; | awk '$1>100{print $2}'

@Pikk45:
Your solution is relying on the size shown by the ls -l output which actually is the block size for a directory. The size of directory should be determined by the total accumulated size of all files present in the directory which du command does.

Guru.

Last edited by guruprasadpr; 04-05-2013 at 11:58 AM.. Reason: changed to 100
# 4  
Old 04-05-2013
Quote:
Originally Posted by guruprasadpr
One way:
Code:
find . -type d -exec du -s '{}' \; | awk '$1>102400{print $2}'

@Pikk45:
Your solution is relying on the size shown by the ls -l output which actually is the block size for a directory. The size of directory should be determined by the total accumulated size of all files present in the directory which du command does.

Guru.
Cool!! You are the GURU Smilie

But when you execute the command of yours, won't it take the present directory that is "." into account as well? <whisper: Got you on this one Smilie>
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

UNIX script to get folder size

can any one help me with a unix command to find out the size of each directory for files placed between 2 dates i.e., date1 & date 2? (3 Replies)
Discussion started by: Codesearcher
3 Replies

2. Red Hat

Sorting folder size not working

I am using du -h --max-depth=2 to get list of folders by size upto 2 levels down. Problem is I am not able to sort them in max folder size. Normally this can be achieved by using du -k | sort -nr * but I can't use it here since it conflicts (the -s argument) with the --max-depth=2 argument. ... (1 Reply)
Discussion started by: rockf1bull
1 Replies

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

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

5. Shell Programming and Scripting

Moving 100K file to another folder using 1 command

Hi, I need to move 1000s of files from one folder to another. Actually there are 100K+ files. Source dir : source1 Target dir : target1 Now if try cp or mv commands I am getting an error message : Argument List too long. I tried to do it by the time the files are created in the source... (6 Replies)
Discussion started by: unx100
6 Replies

6. Shell Programming and Scripting

Split folder into dvd size

Hello everyone, I have a big folder in a linux server that contains dozen of big files (total folder size ~ 50 GB) I have a couple of files of 2.5 GB and some others from 100 MB to 1 GB. (that said it's obvious that it's impossible having two 2.5 GB files in one dvd) The purpose is to... (7 Replies)
Discussion started by: cabrao
7 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. UNIX for Dummies Questions & Answers

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. ... (3 Replies)
Discussion started by: TonySolarisAdmi
3 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

Scripting to find the size of the folder

Will any body help me by writing a script in unix to the find out the size of the Main folder which has some 5 to 6 subfolders which in turn has some file in each of these subfolders regards victorvvk (2 Replies)
Discussion started by: victorvvk
2 Replies
Login or Register to Ask a Question