How to make sure after ftp the file size from windows to unix envt the same?

Posted on 2006-03-29
Last Modified: 2007-12-19
HI Experts,

I am doing production deployment so i ftp files from Windows NT/XP to unix environment .Assume there is no unix view.
Mainly i need to apply check sum during production migration like applying checksum to nt  and unix files to make sure  the size and i need to take screenshot also.
 if i am coping files from unix to unix i can use cksum.But if i ftp files from nt to unix i find differences in bytes.
Like i need to take checksum screenshot for NT as wellas Unix seperately.
Please help
Question by:vikraman_b
    LVL 3

    Author Comment

    need to transfer in ascii format only.
    for example
    i got a file in ClearCase stream NT view say some.sql,some.ini like that, i need to transfer this files from nt to unix envt
    so normally use
    telnet tounix server
    ftp the files under ascii mode and i do the transfer.
    u cannot use binary mode,binary can be used only for jar file,etc.,
    so after transfer i need to check the size in the nt view as well as unix view.
    so i need to apply cksum
    if it is unix view i manually copy the file and take the cksum for source and destination directory if it going to be nt and unix ,how will compare and take the scree shot for logging purppose.
    LVL 38

    Accepted Solution

    You need to make sure that you ransfer the file in BINARY mode to ensure the file size unchange.

    please have a look at these docs:
    LVL 27

    Expert Comment

    I'm slightly familar with ClearCase and with ClearCase views.

    'u cannot use binary mode' - why? You CAN and it's the only correct way to transfer any file (even text file) and only then you will get correct checksums. If you are using CFLF as an EOL in Windows text files and wish LF in Unix, your source and destination files will different and chksum will not help.

    About your question.

    You can use ported 'chksum' utility on Wiindows. It's about 20K in size.

    There are LOTS OF utils (incluting grep, chksum and many others) in one 3Mb zip here:

    You may find them very useful (even sh.exe is included) in your Windows (Just unpack them and update to your PATH env)
    They are natively ported, without CygWin.

    LVL 51

    Expert Comment

    (same as Nopius and yuzh already explained)

    ascii mode is unreliable and causes strange side effects, as you identified yourself
    If you know how your ftp client deals with ascii mode *and* you know the remote ftp server deals with ascii mode, then feel free to use it, but as a result you definitely get files which cannot be compared with checksums.

    If you need to remove for example M$'s useless/stupid \r in text files, then use a reliable converter before or after transfering instead.
    Or better use a reliable editor to create/change your text files inthe format you need them.

    > u cannot use binary mode,binary can be used only for jar file,etc.,
    You can use binary mode for everything, ftp does not know anything about the file content, nor does it look at file extentsions.

    see also http:/Q_21793615.html
    LVL 3

    Author Comment

    Then how to eliminate that ^M  at the end.
    Is it i need to run DostoUnix utiliity or is there any other reliable utility.
    LVL 51

    Expert Comment

    > or is there any other reliable utility.
    unfortunately DostoUnix utility has various names: d2u, dos2unix, to_unix, dos2uc, dosread, fromdos, etc. etc.
    I got sick of that and either use perl or vi or:
      tr -d '\015' <file

    KISS - keep it simple stupid

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
    I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    Video by: Phil
    This video goes over how to configure and start a jail in FreeBSD.  This video is meant to supplement the article included with this course.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now