The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Cp files (>5 Mb size) from one directory to another skcontact UNIX for Dummies Questions & Answers 6 06-12-2008 07:39 AM
files of size 0 need to be deleted inside a directory namishtiwari Shell Programming and Scripting 2 01-28-2008 04:11 AM
Find the size of a directory divz Shell Programming and Scripting 5 01-25-2008 01:57 AM
How find size of directory truth HP-UX 2 12-07-2005 09:12 PM
How to check if 3 files have same size in directory oggle Shell Programming and Scripting 5 02-16-2005 12:51 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-07-2008
astonmartin astonmartin is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 5
Find files size 0 within a directory

Ok, I'm very new to shell scripting and need some help. Given a directory path, I need to find all files within the directory of length/size zero and print the full pathname for each file to a text file. From what I've looked at so far I figured what I have would work but I don't even get an error, it just doesn't give anything for output. Right now I'm just trying to print to the screen so I know if it works right away. Here's what I got:

find $dirpath -type f -size 0 -exec ls {} \;

Any help would be greatly appreciated!
  #2 (permalink)  
Old 02-07-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
Code:
cd $dirpath
find $dirpath -size -1 -exec ls -l {} \;
  #3 (permalink)  
Old 02-07-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
Just leave off the exec part:
Code:
find /dir/path -type f -size 0
  #4 (permalink)  
Old 02-07-2008
astonmartin astonmartin is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 5
Thx

hey thx guys. its alwasy the little things u over look
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:03 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0