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 > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
command to find out total size of a specific file size (spread over the server) abhinov SUN Solaris 3 08-08-2007 06:48 AM
Creat a File with a Specific Size aldowsary AIX 3 12-14-2006 11:35 AM
Find the size of a single specific file nortypig Shell Programming and Scripting 3 08-22-2006 08:00 AM
how to test for file existence using file size? forevercalz Shell Programming and Scripting 3 10-26-2005 10:02 PM
Test to see if a drive is mounted at a specific point spectre_240sx Shell Programming and Scripting 1 05-10-2005 02:48 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-20-2006
GEBRAUN GEBRAUN is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 3
How to test for a specific file size

Hello,

In my shell program, I need to test for a specific size of a text file before it can be imported into an oracle table.

If the size is less than that number, my program should stop processing. What is the correct command to do this test?


Thanks!
  #2 (permalink)  
Old 02-20-2006
Bab00shka Bab00shka is offline
Registered User
  
 

Join Date: Apr 2002
Location: Chesterfield, UK
Posts: 123
to get the file size

file_size=`ls -l <path_to_file>| awk '{ print $5 }'`

then do an if

if [ $file_size -lt <size> ]
then
exit
fi
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 09:07 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