Link to home
Create AccountLog in
Avatar of vikraman_b
vikraman_b

asked on

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

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
Avatar of vikraman_b
vikraman_b

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of yuzh
yuzh

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Hello.
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.



(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.,
wrong
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
Then how to eliminate that ^M  at the end.
Is it i need to run DostoUnix utiliity or is there any other reliable utility.
> 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