LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-05-2004, 02:57 AM   #1
chrisfirestar
Member
 
Registered: Sep 2003
Location: Adelaide, Australia
Distribution: Fedora/RH
Posts: 231

Rep: Reputation: 30
Scanning Files and Deleting Blank Ones


I would like to be able to scan a series of files and remove the ones that are empty...

I have created a series of log files (that breaks up the logs into IP addresses however it will also create blank documents.

Is there a way to scan a file... if their is no content it will automatically delete the file??

how to do this?

Thanks
Chris
 
Old 02-05-2004, 05:05 AM   #2
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
This might help you get started. It should list all your files and the size.
ls -Al|awk '{print $9,$5}'
 
Old 02-05-2004, 09:18 AM   #3
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
find /directory -size 0 -exec rm {} \;
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting files in C monil Programming 4 03-13-2005 11:33 AM
unable to initalize the virus scanning engine data base files reservation1 Linux - Security 1 10-23-2004 11:40 PM
Deleting files! a_priebe47 Slackware 6 10-17-2004 10:58 PM
Deleting files ShakyJake Linux - Newbie 12 05-08-2003 04:07 PM
Deleting files Tingle Linux - Newbie 4 01-16-2003 05:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:24 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration