ftp hangs on file size = 0

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers ftp hangs on file size = 0
# 1  
Old 04-05-2002
Network ftp hangs on file size = 0

I have an ftp process which runs every 10 minutes between Unix and an NT box.

Normally it works, but when the script tries to get a file from NT that has a length of 0, the ftp process hangs (as if it is still waiting for the end of the file).

This is the script

echo "user $username $password" > $ftp_cmd

for file in `cat $ftp_lst`
  echo "get $file" >> $ftp_cmd
  echo "delete $file" >> $ftp_cmd
echo quit >> $ftp_cmd

ftp -n $host < $ftp_cmd > $ftp_log

Any ideas on why it hangs ?



added code tags for readability --oombera

Last edited by oombera; 02-18-2004 at 01:32 PM..
# 2  
Old 04-08-2002
file attributes?

What is different about the files that have 0 bytes. Check the file permissions. Is it archive or protected. In dos, you can type "help dir |more" and choose the option to view file permissions.

Is the file read only?
# 3  
Old 04-19-2002

Thanks for your help.

I haven't been able to confirm the file permissions yet, because this problem happens infrequently (it happens to screw a lot of things up when it does happen though...).

I did find out though on this version of NT if you use 'get' to retrieve a file that doesn't exist NT creates it for you with filesize=0...So it sounds like that could be the problem.

# 4  
Old 04-19-2002
That could be your problem.

If you login from NT to UNIX , you should be using "put" to move files FROM NT to UNIX. You should be using "get" to move files FROM UNIX to NT.

If you login from NT to UNIX and then try to use "get" it will try to pull down a file from UNIX to NT. If it doesn't exist, it will generate a 0 byte file!

Try to alter your script to first check to see if files exist before it tries to "get".

Smilie Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. IP Networking

Ftp hangs

On Oracle Linux 5, 64 bit (derivative of RHEL) ... I have a shell script that runs every Sunday, that ftp's a bunch of files from server 'prod' to server 'test'. Script executes on 'test'. This has been running for YEARS with no problem. Normally the FTP step takes about 1.5 to 2 hours. (pulls... (8 Replies)
Discussion started by: edstevens
8 Replies

2. UNIX for Advanced & Expert Users

FTP zero size file

Hi AM using unix Aix Ksh I need to clarify regarding sending the zero size file to another server. VAL=ftp.sh -c put souce_file Dest_file $1 $2 $3 $4 $5 $VAL 2 > $ERR When am Sending the Zero Size File getting alerts netout write returned Zero. But i would like to know $VAL... (4 Replies)
Discussion started by: Venkatesh1
4 Replies

3. Shell Programming and Scripting

FTP a huge Size file

Dear All, Good Evening!! I have a requirement to ftp a 220GB backup file to a remote backup server. I wrote a script for this purpose. But it takes more than 8 hours to transfer this file. Is there any other method to do it in less time??? Thanks in Advance!!! ---------- Post updated... (5 Replies)
Discussion started by: Naga06
5 Replies

4. Shell Programming and Scripting

Checking the size of a file after FTP

Hi I am doing a FTP process through which I am copying a file from my local server to Remote server. After this I want to check the size of the file Below is my program: LOCALDIR=/batch/ediprocess REMOTESERVER=test.appl.com REMOTEPATH=batch/ftpTest LOGIN=px PASSWORD=abcd ftp -n... (3 Replies)
Discussion started by: shanth_chandra
3 Replies

5. UNIX for Dummies Questions & Answers

rcp and ftp hangs

Hi there, We I attempt to rcp/ftp data from server A to server B. It copies until halfway and throw out the error: rcp: connection lost ftp netin: Connection reset by peer 421 Service not available, remote server has closed connection However, when rcp/ftp from server A to server C, it... (1 Reply)
Discussion started by: *Jess*
1 Replies

6. Shell Programming and Scripting

How to check file size before and after FTP

I want to trasfer file from 1. Unix server A to server B 2. Unix server A to windows directory Is there a way to check the size before and after FTP. I want to check the size of the file in server A before FTP and in server B after FTP in case 1 In case 2 I want to check the size of... (1 Reply)
Discussion started by: i.scientist
1 Replies

7. Shell Programming and Scripting

size of a file that iam ftp ing

Hi, I want to compare the size of the files in my local machine before ftp ing it and the size of the file in the remote machine i.e after ftping . SO that the ftp is successful . (3 Replies)
Discussion started by: dineshr85
3 Replies

8. Shell Programming and Scripting

How to compare file size after ftp?

Is possible if I want to campare file size on source and destination after ftp transfer? If anybody know, please explain to me. (1 Reply)
Discussion started by: icemania
1 Replies

9. Shell Programming and Scripting

Perl FTP - check file size

The FTP perl module does not have any function which checks if the file downloaded is of size 0. Is there any way in perl to check while getting the files through FTP? Sometimes, there might be a problem with FTP and the downloaded file maybe of size 0. Hence, I would like to FTP that file... (1 Reply)
Discussion started by: rahulrathod
1 Replies

10. UNIX for Advanced & Expert Users

ftp file size

how to compare file size which has been received through ftp get from a remote location with local copy available any clue regards (5 Replies)
Discussion started by: sathiya
5 Replies
Login or Register to Ask a Question