LFTP shell executable not working when trying to mirror (: No such file or directory)

99 Views Asked by At

I am having some problems while trying to run a script in my ubuntu terminal with LFTP commands. I want to update a folder from my server to a remote one via FTP.

This is my code (.sh):

HOST='sftp://target-server.com'
USER='ftp_user'
PASS='1234'
TARGETFOLDER='/target/folder'
SOURCEFOLDER='/source/folder'
lftp -c "
open $HOST
user $USER $PASS
lcd -R $SOURCEFOLDER
mirror --reverse --delete --verbose $SOURCEFOLDER $TARGETFOLDER
bye
"

The thing is, if I type the same commands on the terminal, it works. But if I execute the same code on the script I get the error ": No such file or directory".

I have granted all permissions on the folder, and if I run the script step by step, it connects correctly. It is the mirror part where it fails.

Can please someone help me?

Thanks in advance!

0

There are 0 best solutions below