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
Calculate the time difference between a local file and a remote file. meetmano143 Shell Programming and Scripting 1 11-04-2008 02:59 PM
File System - Remote or Local?? Un1xNewb1e UNIX for Dummies Questions & Answers 1 04-11-2008 04:23 PM
how to mount a file system of a remote machine to local file system cy163 UNIX for Dummies Questions & Answers 2 01-31-2008 09:04 AM
how to find whether a file is local or remote file? jackfds UNIX for Dummies Questions & Answers 3 07-10-2007 08:36 AM
file size in bytes is different in ftp and local pc umen UNIX for Dummies Questions & Answers 2 06-04-2007 04:58 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 11-13-2008
dba.admin2008 dba.admin2008 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 7
file size comparision local file and remote file

Hi,

I have written a script which would FTP a dump file to the FTP server and log the whole activity into a file. to confirm the success of the file copy i grep for "226 file receive OK" and then send out an email saying success. Now i want to make sure the bytes of the local file and remote file are the same.

i read on the forum that we can do an ls -l on the local and remote files and compare the two..

Upon my research i couldn't find a statement which will extract the bytes from a FTP file and put that into a variable so that i can compare...

Need some help with that.
  #2 (permalink)  
Old 11-13-2008
Lakris Lakris is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 242
Hi,
how about using wget (or Your ftp method), to read the file back again, with another name, and then diff them? For example if ASCII/CRLF conversion could mess thing up...

/Lakris
  #3 (permalink)  
Old 11-13-2008
dba.admin2008 dba.admin2008 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 7
thanks for the reply Lakris...

i did a
result=`ssh user@<hostname> ls -l <filename> | awk '{print $5}'`

this gave me the size in bytes . This fits my requirement.
  #4 (permalink)  
Old 11-13-2008
Lakris Lakris is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 242
Great, np,
You could also try

result=$(ssh user@<hostname> stat -c%s filename)

to avoid problems with different formats of ls (LOCALE and such stuff)

/Lakris

PS AND to avoid awk, since I'm just too bad at it
  #5 (permalink)  
Old 11-13-2008
dba.admin2008 dba.admin2008 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 7
something new. i will try that...
thanks Lakris...
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 04:22 PM.


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