How to separate 0kb files from the rest!!!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to separate 0kb files from the rest!!!
# 1  
Old 04-02-2007
How to separate 0kb files from the rest!!!

Hi All,

Can you please tell me how to identify a 0kb file from a list a files and redirect only those files to a .txt file.

ls -l shows me all the 0kb files...but how to redirect only those files..

Thanks for ur help,
Kumar
# 2  
Old 04-02-2007
Code:
find . -size 0 -print > a.txt

# 3  
Old 04-02-2007
you can use find with -size switch
Code:
find . -type f -size 0  -print > out.txt

# 4  
Old 04-02-2007
Thanks a lot for your response Anbu and Ghostdog....it working fine....
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

0kb file transferred in FTP process

We are transferring xml files to remote machine through cronjob @every 5 mins and then will move the files to the backup folder is source server. Sometimes the file is transferred as 0kb to destination server, whereas the file in the source backup folder is completely written. There is no error... (6 Replies)
Discussion started by: Bhavi
6 Replies

2. Shell Programming and Scripting

Need separate vi files in shell

Input: I have input file below mentioned.Input file has Yahoo,gmail,yuimn etc..are websites and there are users listed under it. I have many other unique websites but i mentioned just few as below. For example: Yahoo is website and 123,fsfd are members of website "yahoo". See below input... (19 Replies)
Discussion started by: buzzme
19 Replies

3. Shell Programming and Scripting

Merge two input files and concatenate the rest

Hi Guys, I need a help to creating a bash script to merging two files that containing not in order pattern into single file also within that single file I need to concatenate and manipulate the string from two files. Appreciate for any kind help given. Thanks. Here are the input files:... (3 Replies)
Discussion started by: jabriel
3 Replies

4. Web Development

Two separate domains - and files

Hi, I've been asked to 'troubleshoot' a webserver where two different TLDs are being served. Or to be more accurate, 'domain.com' and 'domain.fr'. So we have /var/www/domain.com /var/www/domain.fr And then for some reason, the httpd.conf file points to two different configuration files.... (1 Reply)
Discussion started by: davidm123SED
1 Replies

5. Shell Programming and Scripting

Using bash to separate files files based on parts of a filename

Hey guys, Sorry for the basic question but I have a lot of files that I want to separate into groups based on filenames which I can then cat together. Eg I have: (a_b_c.txt) WB34_2_SLA8.txt WB34_1_SLA8.txt WB34_1_DB10.txt WB34_2_DB10.txt WB34_1_SLA8.txt WB34_2_SLA8.txt 77_1_SLA8.txt... (1 Reply)
Discussion started by: Breentax
1 Replies

6. UNIX for Dummies Questions & Answers

File SIZE 0KB help

Hi There, I need a script which shud basically check the size of the file..if its is 0kb send email to a list of people and if is > 0KB, send an email to someother list... Please help (1 Reply)
Discussion started by: saggiboy10
1 Replies

7. Shell Programming and Scripting

want to concatenate multiple files based on the rest of ls -lrt

uadm@4132> ls -lrt -rw------- 1 uadm uadm 3811819 Jun 6 04:08 data_log-2010.05.30-10:04:08.txt -rw------- 1 uadm uadm 716246 Jun 13 01:38 data_log-2010.06.06-10:04:08.txt -rw------- 1 uadm uadm 996 Jun 13 04:00 data_log-2010.06.06-10:04:22.txt -rw------- 1 uadm uadm 7471 Jun 20 02:03... (5 Replies)
Discussion started by: mail2sant
5 Replies

8. Shell Programming and Scripting

Shell script to FTP if file size is 0KB

Hi all, I was a UNIX shell script that will check for the file size of each file and it should be re directed to a text file say filesize.txt And if there are more than 10 0KB files then FTP should not happend and whenever there are less than 10 0KB files it should FTP the files. Kindly help me... (1 Reply)
Discussion started by: Codesearcher
1 Replies

9. Solaris

0KB printing files

Hi, I am dealing with strange problem... whenever we use our software to trigger some printing files, along with that it generates lot of zero KB printing files, in our code base we generate a printing file only if its size is >0. So I suspect it could be something to do with printing level... (2 Replies)
Discussion started by: vivek.gkp
2 Replies

10. UNIX for Dummies Questions & Answers

Delete files with 0kb

Hi, i need to strip out a logfile dir, but only remove the files with 0kb . How would i go about doing this? TIA (3 Replies)
Discussion started by: mephisto
3 Replies
Login or Register to Ask a Question