Skip to content

Configuring the sftp Transfer Method for ASCII or Binary

SFTP supports two transfer methods: ASCII and binary. In ASCII mode, individual letters, numbers, and characters are transferred using their ASCII character code, and the receiving computer saves these in the correct text format for that system. During ASCII transfers between UNIX and Windows computers, newline characters are converted as appropriate for each system. (You can also manually configure newline character conversion if necessary.) In binary transfers, data is transferred to the server byte-by-byte with no data conversion.

Reflection for Secure IT UNIX Client and Server also provides a smart transfer option called auto. In auto mode, the transfer method is determined by file extension. Files with specified file extensions use ASCII transfer; all other files use binary transfer. The default list of ASCII file types is txt, htm*, pl, php*. To modify this list for a given sftp session, use the setext command. To change the default file extension list, use the client keyword FileCopyAsciiExtensions.

sftp command Effect
ascii -s Displays the current transfer mode.
binary Sets the current transfer mode to binary (the default).
auto Sets the current transfer mode to auto. Files specified in FileCopyAsciiExtensions use ASCII transfer.
getext Displays the current list of file extensions that use ASCII file transfer when auto mode is enabled.
setext Specifies the current list of file extensions that use ASCII file transfer when auto mode is enabled. To specify multiple extensions, use a comma or space-separated list; this command is not cumulative. Wildcard (zsh-glob) characters are supported. Don't precede file extensions with a period. To specify extensions containing spaces, use quotation marks around the extension or use a backslash as an escape character.
ascii Sets the current transfer mode to ASCII. When no remote newline is explicitly stated, the client attempts to retrieve the newline convention from the server. If the server does not support this functionality, the client sets the remote newline to CRLF.
ascii dos Sets the remote newline to CRLF.
ascii unix Sets the remote newline to LF.
Client keyword Effect
FileCopyAsciiExtensions Specifies the default list of file types for ASCII file transfer when auto mode transfer is enabled. The default is 'txt, htm*, pl, php*'.