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
how to find the file size in unix lmraochodisetti UNIX for Advanced & Expert Users 5 12-16-2008 08:51 AM
Find file size and date gsusarla UNIX for Advanced & Expert Users 10 04-08-2008 05:33 PM
find file size hgriva1 Shell Programming and Scripting 6 11-07-2007 04:07 AM
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
find the file by size rooh UNIX for Dummies Questions & Answers 1 08-16-2001 07:21 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-28-2008
kittusri9 kittusri9 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 40
How to find size of a file

Hi,

I have to directory
/usr/inbound
-------------
10900.txt
10889.txt
109290202.txt

I need to create inbound directory
and i need to know size of these files one by one
if file size is zero i need to print message like "empty file"

Please help me how to solve this

thanks
krish.
  #2 (permalink)  
Old 04-28-2008
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is offline Forum Staff  
Soulman
  
 

Join Date: Jul 2006
Location: Germany, Berlin
Posts: 2,910
the "du" and the "ls -l" command give you information about the size of a file. you can also work with "find" to find files that are 0 bytes in size...
  #3 (permalink)  
Old 04-28-2008
kittusri9 kittusri9 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 40
I need to know file size one bye one
/usr/inbound
-------------
10900.txt assume 2k
10889.txt 0k
109290202.txt 0k


I need to know file one bye one,
take file names one by one and find size of each file and print the sizes

hope you understand my problem
please help me on this.
  #4 (permalink)  
Old 04-28-2008
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is offline Forum Staff  
Soulman
  
 

Join Date: Jul 2006
Location: Germany, Berlin
Posts: 2,910
i understand your problem and give the solution above... read the "manpage" of the tools and find the tool that helps you out...

for example you can do a "du -sk *.txt" in the directory your files are located. to print the mentioned message you need a little script... and it's your work to write this script, isn't it?
  #5 (permalink)  
Old 04-28-2008
kittusri9 kittusri9 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 40
Hi
Thankyou
i got it.................it works fine
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 09:07 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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