System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

How to set SFTP to transfer the files in ASCII mode

SOLVED
Go to solution
Narendra Uttekar
Regular Advisor

How to set SFTP to transfer the files in ASCII mode

Hi,
I want to transfer the files through SFTP in ASCII mode, But i know there is no command available to set it in ASCII mode. But there is something call dos2unix utilty to convert the files first before i send the files through sftp. Please anyone can tell me where is this utilty available and how to use, so that i can transfer the files through SFTP.

Thanks,
Narendra
6 REPLIES
Tingli
Esteemed Contributor

Re: How to set SFTP to transfer the files in ASCII mode

You can use free WinSCP to do the work. And I think it handles bin and ascii by itself.
James R. Ferguson
Acclaimed Contributor
Solution

Re: How to set SFTP to transfer the files in ASCII mode

Hi:

The utility is 'dos2ux' and 'ux2dos' (see the manpages!). BUT, as mentioned, tools like 'winscp' offer the ability to perform ASCII or binary transfers where the former handle any necessary addition/subtraction of carriage-return characters.

Regards!

...JRF...
Bill Hassell
Honored Contributor

Re: How to set SFTP to transfer the files in ASCII mode

ASCII mode is a special feature of standard FTP and designed to exchange between many, many different systems (not just DOS). ux2dos and dos2ux will take care of just one of those systems. You can create a simple script just for ASCII, but if you have a lot of files and need confirmation of delivery or temporary names at the destination followed by a rename, take a look at NCftp.


Bill Hassell, sysadmin
Steven Schweda
Honored Contributor

Re: How to set SFTP to transfer the files in ASCII mode

> I want to transfer the files through SFTP
> in ASCII mode, [...]

From what? "uname -a"?

To what?


Some SFTP client programs actually have an
"ascii" command, by the way.
Matti_Kurkela
Honored Contributor

Re: How to set SFTP to transfer the files in ASCII mode

In some SFTP clients, the "binary" and "ascii" commands exist only to provide command-level compatibility with regular FTP, and will have no effect at all (the commands are accepted but ignored).

Lesson learned: read the documentation of your SFTP client carefully!

The dos2ux/ux2dos commands change only the line termination characters. When moving text files from one type of computer system to another, it may be necessary to apply character set conversions too. The "iconv" tool is included in HP-UX for this purpose.

http://docs.hp.com/en/B2355-60127/iconv.1.html

If files are transferred between two Unix systems that are configured to use the same character set, there is no need to apply any conversions and you can just transfer the files as-is. This is what the "binary" mode of FTP does, and also what SFTP does (unless the client has some extra features).

MK
MK
Narendra Uttekar
Regular Advisor

Re: How to set SFTP to transfer the files in ASCII mode

Thanks for the solution.