I want to create a directory if it doesn't exists after login to sftp server.
test.sh
sftp name@example.com << EOF
mkdir test
put test.xml
bye
EOF
Now i call test.sh and upload different files each time to test folder. When running this
mkdir test
First time it works and second time it throws Couldn't create directory: Failure error?
How to create a directory if doesn't exists and if exists don't create directory in sftp.
Best Solution
man 1 sftp
(fromopenssh-client
package):So: