I am able to zip and transfer files using SFTP with the below commands from my script:
zipfilename="Order_$(date +"%Y%m%d%H%M%S").zip" echo "Start Execution" $(date +"%Y%m%d%H%M%S") >> "$logfile" echo "Zipping Files" >> "$logfile" zip $zipfilename order*.xml echo "Zipping Success" >> "$logfile" echo "put $zipfilename In" | sshpass -p $PSWRD sftp firstname.lastname@example.org >> "$logfile"
Below is the result:
sftp> put Order_20190830221440.zip In Uploading Order_20190830221440.zip to /In/Order_20190830221440.zip
I am able to confirm that the zipped file is getting transferred successfully. However, when I try to unzip it via SFTP I get an error. I am using the below commands:
echo "unzip $zipfilename" | sshpass -p $PSWRD sftp email@example.com >> "$logfile"
The error is as follows:
sftp> unzip Order_20190830221440.zip Invalid command.
I've tried this both for
Any idea what the issue might be?