I'm using a Bash script to backup my webfiles via FTP. As the title says, I have an Ubuntu webserver and am backing up to a Windows machine. I have an ssh program and FileZilla Server on the Windows machine, and can SSH and SFTP into it. The core of the script looks like this:
SRCDIR="C:\\Users\\Tech1\\testserverbackup"
DATAIN="/var/www/html/"
FILENAME="-r *"
sshpass -e sftp -oBatchMode=no -b - ${USER}@${LANHOST} << EOF
cd ${SRCDIR}
lcd ${DATAIN}
mkdir $(date -I)
cd $(date -I)
put ${FILENAME}
bye
echo made it
EOF
The others vars are a bit sensitive, so I don't want to post them, but the credentials have been working for me so far.
The error I'm getting looks like this:
sftp> cd C:\Users\Tech1\testserverbackup
Couldn't stat remote file: No such file or directory
I've ssh'd into the folder and sftp'd, so I'm not really sure what the issue is. AFAIK, cd is the native windows command, not just the FTP one.
Any ideas what's going wrong? Thank you.