![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Checking for a file in file pattern before deleting it | dsrookie | UNIX for Dummies Questions & Answers | 1 | 05-09-2008 05:29 PM |
| Error checking a file from previous file size | stuck1 | Shell Programming and Scripting | 2 | 12-06-2007 08:39 AM |
| checking size of the first line in a log file | kiran1112 | Shell Programming and Scripting | 19 | 03-22-2007 02:46 PM |
| Help with checking file size | ssmith001 | Shell Programming and Scripting | 15 | 09-08-2005 10:48 PM |
| Checking file size | jkuchar747 | UNIX for Dummies Questions & Answers | 2 | 03-02-2005 02:34 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I'm having a problem with a bash shell
The shell is running through a list of zip filenames, copying the zip files to another location and adding a file to the zip files. All this is working great, however I also need to report on the size of the zip file and I keep getting wrong answers. Here's how I currently have it set up Code:
cat $INPUT_FIL | while read ITEM do #copy zip file to new location, add file ZIP_SIZE=`ls -sh $ZIP_FIL` echo $ZIP_SIZE done I've also tried using wait $! How can I get an accurate size count? |
|
||||
|
I'm assuming you're on Linux:
First off, ls -l gives the file size in bytes, ls -lh makes it human readable. Plus, I don't see where you are copying things. -s gives a size in blocks. If you copy from one filesystem to another, filesystem #1 may have a blocksize of 512, the other filesystem #2 may have a blocksize of 1024, so -s would give you differing results. Don't use -s |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|