hi guys,
i need a script to sftp the file from windows to unix server ....(before that i have to check whether the file exists in the windows server or not
and again i have to reverse sftp the files from unix to windows server.....
can u please help me on this...? i need ftp(s) secured transfer -->sftp script how can i do it...?
---------- Post updated at 12:07 PM ---------- Previous update was at 11:32 AM ----------
Hi RudiC,
actually i dnt have idea on this SFTP
wat i did is
i had the windows remote path and unix path
so at first i checked for the existing file in the widows server using if statement...
after that i dnt have any idea on this SFTP i googled it but i dnt get any exact solution for this thing... i know that i did nothing ... but i have no idea on how to kick start this.....
i had something on my mind like this...
sftp ${REMOTE_USER}@${REMOTE_MACHINE} <<EOF
cd ${REMOTE_DIR}
if [[ -f "$REMOTE_DIR"/"$FILE_NAME_TO_CHECK" ]]; then
get *
As you want to run the script interactionless, you have to know the remotedir/filename, so it would be pointless to check its existence first - it's there or not. Why not get it and check success/failure?
Try
Very old ftp ran on tcp ports 21, 20 and high ports unsecured only by a password sent in the clear. It had an arcane command set, somewhat like a severly truncated shell.
ssh runs on a different tcp port/server, 22 by default, is secure and can be set up with PPK trust so no password is needed, which supports secure scripts. It is a secure tcp socket with apps that allow remote shell, tcp tunnels or file copy.
sftp is a wrapper for ssh that speaks ftp. It is for people who want to keep using an ftp script already written, not you.
scp/winscp is another wrapper for ssh, more like the rcp and cp commands. For Push you just: