Validating the size of file transferred from ftp server to the local system


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Validating the size of file transferred from ftp server to the local system
# 1  
Old 04-07-2011
Validating the size of file transferred from ftp server to the local system

Validating the size of file transferred from ftp server to the local system.

File type: Text file/Flat file
Source System: Windows / Unix Systems
Target System is always: Unix
Mode of Transfer : ASCII

We have generic ftp shell script that transfers the files from different ftp servers.

Some time files are only getting transferred partially & doesn't show any errors.
An example scenario is given below.
Example Scenario:
Souce System: Unix
Source File's size: 4000 Kbytes.
Target System: Unix
Target File size: 2000 K bytes.
Reason for the difference in File size: As the target unix system is not having enough space, & the FTP utility doesn't treat this kind of scenario as an error, the final outcome of the script was successful.

We would like to handle this scenario with the addition of the logic to check the file sizes of the source & target system and decide the final outcome of the script. Please provide your thoughts/suggestions.

Options Tried:
We also tried one of the option that ftp log itself is capturing the file size while transferring. This size is not matching with actual file size got transferred to the local system due to difference in the OS of source and destination.
# 2  
Old 04-08-2011
Ancient classic problem:
  • The cheapest thing is to put the size in the file name, unless this is dos. Then the recipient can check to see if it is right. On a good day, the recipient can tell it is no longer being written, like with fuser.
  • Send the length or better yet the cksum in a marker file, afterwards so it tells the recipient that the file is all sent.
  • The sending end could send to a temporary name or folder, then check the length, and finally rename/move the file to the right name, which intrinsically tells the recipient that it is valid.
  • Crude, lewd but secure: fetch the file back and compare it byte for byte. You might still need some token to tell the other end it is ready, like a rename/move or an ack file.
# 3  
Old 04-08-2011
Quote:
Originally Posted by jpundalik
Source System: Windows / Unix Systems
Target System is always: Unix
Mode of Transfer : ASCII
I don't work with ftp very often (except as a client fetching stuff from the internet), but doesn't ASCII transfer mode change a text file's contents and size when the systems involved use different line endings?

Regards,
Alister
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

0kb file transferred in FTP process

We are transferring xml files to remote machine through cronjob @every 5 mins and then will move the files to the backup folder is source server. Sometimes the file is transferred as 0kb to destination server, whereas the file in the source backup folder is completely written. There is no error... (6 Replies)
Discussion started by: Bhavi
6 Replies

2. Shell Programming and Scripting

Deleting local server file from automated FTP script

Hi, I want to delete a file on the local server, while connected to remote server through FTP. I am using the below code for this $FTP_CMD -v -n $HOST <<*! >> $LOGFILE 2>&1 user $USER $PASSWORD cd $DIR ... (11 Replies)
Discussion started by: jhilmil
11 Replies

3. Solaris

Ftp a directory to another server from the local server what is the command

ftp a directory to another server from the local server what is the command (2 Replies)
Discussion started by: PMoore
2 Replies

4. UNIX for Dummies Questions & Answers

What happens if i unmount local file system when is mounted to a different server?

Hi, as title says what happens if i unmount local file system when is mounted to a diffrent server ? (2 Replies)
Discussion started by: galuzan
2 Replies

5. AIX

Do I need to configure my local windows to FTP files from local windows to a UNIX AIX server?

Hi Friends, I have this script for ftping files from AIX server to local windows xp. #!/bin/sh HOST='localsystem.net' USER='myid_onlocal' PASSWD='mypwd_onlocal' FILE='file.txt' ##This is a file on server(AIX) ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD put $FILE... (1 Reply)
Discussion started by: rajsharma
1 Replies

6. Shell Programming and Scripting

preserving the timestamp of a file when copied from remote server to local server using ftp

Hi, I need to copy few files from remote server to local server. I write a shell script to connect to the remote server using ftp and go to that path. Now i need to copy those files in the remote directory to my local server with the timestamp of all those files shouldnt be changed. ... (5 Replies)
Discussion started by: arunkumarmc
5 Replies

7. Shell Programming and Scripting

how to FTP a file from the local folder to unix server

Hi All, please help me to write a shell that ftp a file which is in the local (C:\) drive to a Unix server. Where as i know the IP for the Unix server. i could do this process by using ftp command. pls help me to write as Shell script. Thanks in advance for all of your answers.:b::b: (3 Replies)
Discussion started by: little_wonder
3 Replies

8. UNIX for Dummies Questions & Answers

file size in bytes is different in ftp and local pc

Hi how can it be that say i have text (xls) file that is 661 bytes when i upload it to Solaris ftp its becomes 650 byes and when i downloading it back its again 661 bytes both in my local pc and Solaris ftp the file remains not corrupted and valid (2 Replies)
Discussion started by: umen
2 Replies

9. Shell Programming and Scripting

Dowloading a File from FTP Server to a local Server where User Id's are different

Hi, The Setup is like this. I'm connecting to Unix machine from my local machine. After connecting to Unix M/c, i need to connect FTP server. Am successful in connecting to FTP server, but am not able to download the file from the ftp server to my local machine. I have different user id's and... (1 Reply)
Discussion started by: ranjith_taurean
1 Replies

10. Shell Programming and Scripting

FTP multiple files from remote server to local server

Hi, I am facing a weired problem in my FTP script. I want to transfer multiple files from remote server to local server everyday, using mget * in my script. I also, want to send an email for successful or failed FTP. My script works for file transfer, but it don't send any mail. There is... (2 Replies)
Discussion started by: berlin_germany
2 Replies
Login or Register to Ask a Question