[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2006-03-29
Medium Priority
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

Author Comment

ID: 16326696
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

yuzh earned 750 total points
ID: 16328341
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

ID: 16328425
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: http://unxutils.sourceforge.net/

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.


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

LVL 51

Expert Comment

ID: 16329847
(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

Author Comment

ID: 16333480
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

ID: 16339963
> 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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
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.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month20 days, 4 hours left to enroll

872 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