Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to send a file to a FTP server using Perl. The program works almost well, but the file size changed (file size on remote host is different from localhost). After checking, i realize that: it's not the my Perl script's error but the FTP client's error.

Let's say: I have a computer (A) running Cent-Os 5. I want to send a wav file (802_20130511_111637.wav - 207,084 bytes) to a remote computer (B). The FTP server on (B) is File Zillar 0.9.41.

I did following commands from (A) console (for safety, I've changed hosts name and user name):

[root@abcxyz 1234]# ls -l
total 464
-rw------- 1 asterisk asterisk  99564 May  8 10:39 0913255236_20130508103929.wav
-rw------- 1 asterisk asterisk 127084 May  7 22:42 0918272810_20130507224217.wav
-rwxrwxrwx 1 asterisk asterisk  16488 May  7 16:45 1234.wav
-rw-r--r-- 1 asterisk asterisk 207084 May 11 11:17 802_20130511_111637.wav
[root@abcxyz 1234]# ftp
ftp> open
Connected to
220 FileZilla Server version 0.9.41 beta
502 GSSAPI authentication not implemented
504 Auth type not supported
KERBEROS_V4 rejected as an authentication type
Name ( my_user_name
331 Password required for my_user_name
230 Logged on
Remote system type is UNIX.
ftp> put 802_20130511_111637.wav
local: 802_20130511_111637.wav remote: 802_20130511_111637.wav
227 Entering Passive Mode (xxx,xxx,xxx,xxx,195,159)
150 Connection accepted
226 Transfer OK
207503 bytes sent in 0.029 seconds (7.1e+03 Kbytes/s)

As you can see. The file size (at line 6) is 207084 bytes. But the size (at the almost last line) is 207503 bytes.

Exactly, the file size changed after send through FTP. I've downloaded two files above (one from (A) and one from (B) ) to another PC (running Windows). The one comes from (A) can be played well, but the one from (B) cannot.

Please correct me if I did any wrong. Why the file size changed although I've used native FTP client?

share|improve this question

migrated from May 13 '13 at 13:54

This question came from our site for professional and enthusiast programmers.

You never issued the bin command (or whatever your client uses), so it's performing line-ending translation.

share|improve this answer
Thanks @ikegami. This helps me a lot! – user2372419 May 13 '13 at 9:55

You must log in to answer this question.