If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Get the size of a file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-05-05, 08:52
loopoo loopoo is offline
Registered User
 
Join Date: Aug 2005
Posts: 23
Get the size of a file

Hi !

I need to get the size of a file, and if this is possible, it would be great: I need a command that I can pass the filename to, and that would return the size of the file. It's not important to be in bytesm human readable or other...I just want to check if the file is empty or not!

Thanks in advance,
Chris
Reply With Quote
  #2 (permalink)  
Old 12-05-05, 09:30
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
test -s filename # True if filename exists and has a size greater than zero.
or get size with wc or
ls -l filename | read x x x x filesize x
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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