LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-16-2010, 11:31 PM   #1
elainelaw
Member
 
Registered: Jan 2008
Posts: 258

Rep: Reputation: 30
check file size


if I want to check the file , to find the file which file size = 0 , if have these kind of files , then output the file name to a file ( eg. /tmp/checkfile ) , if no such file then output message "No empty file" , to /tmp/checkfile , can advise what can i do ?

I know the script to check file size =0 is as below , can advise how can i do the rest of checking ?

find . -type f size 0
 
Old 12-17-2010, 12:09 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
'find . -type f -size 0 > /tmp/checkfile; [ -s /tmp/checkfile ] || echo "No empty file" > /tmp/checkfile'

* BTW a lot of your recent questions seem to be drive-by one-liners that show absolutely no effort from your side and often get no response to replies from you. Sure you are entitled to an answer but at the same time we may (hopefully) expect from you by now that you know how to find information and try basic things before asking.
** BTW what you did here (http://www.linuxquestions.org/questi...5/#post4146919) is inexcusable. Do not do that again.

Last edited by unSpawn; 12-17-2010 at 05:43 AM. Reason: //Warn
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Check the size of a file using FTP vipi2005 Linux - Networking 2 09-07-2010 11:19 PM
BASH. How check file size ? rbalaa Programming 4 03-26-2010 07:22 AM
How to write crontab to check file size and all file in a directory? modpriest Linux - Newbie 1 02-14-2008 06:48 AM
perl- check size to see if file is complete michael.barnes Programming 2 02-13-2008 06:20 PM
Need script to check file size. _TK_ Linux - General 1 08-06-2001 08:30 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration