SFTP – Transferring Files in Binary Mode

aixftpsftp

While using FTP we can use the option bi to transfer files in binary mode however I am unable to find similar option in SFTP. Please find my code snippet below..

fileTransferToDEST()
{
echo "mput $4/$1 $3/" | sftp -b - $SRV_USER@$DEST_IP
}

fileTransferToDEST $filename $logpathwithfilename $destinationpath $sourcepath

returnvalue=$?

if [ "$returnvalue" != "0" ]; then

                echo;echo "FTP : Failed while transfering"
                exit 2

fi

Please advise. Thanks in advance.

Best Answer

OpenSSH sftp supports the binary mode only. So it's implicit.

See also How to transfer binary file in SFTP? (on Stack Overflow)

Related Question