2

I need to copy a file over SFTP to a specific directory. I use LFTP because this connection requires an IP6 mDNS name.

lftp sftp://admin:[email protected] -e "put file.txt; bye"

This works, but the file ends up in /home/admin

I want the file to end up in /home/admin/upload

Can I somehow specify the destination directory? I'd be happy to use an additional command to do so, but it must be scripted with lftp/sftp

0

2 Answers 2

5

Perhaps all you need is an additional command:

lftp sftp://admin:[email protected] -e "cd upload; put file.txt; bye"
1
  • Good find. LFTP is pretty cool. It's one of the only CLI utilities in OSX that can resolve an IPv6 mdns name. Commented Oct 10, 2017 at 12:09
0

You can use -O flag to specify the target directory.

lftp sftp://admin:[email protected] -e "put -O remote/directory file.txt; bye"

Find the docs here: https://lftp.yar.ru/lftp-man.html

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.