I'd like to put files from result of !find command from lftp.
I tried:
$> lftp -u foo, sftp://bar
lftp foo@bar$> put < !find ./local -type f
But failed!!
This worked:
$> lftp -u foo, sftp://bar
lftp foo@bar$> !find ./local -type f | awk '{print "put "$1}' > /tmp/files.lftp
lftp foo@bar$> source /tmp/files.lftp
Is there another way!? I'd like to use stdio redirects (pipes, stdin...).
I have read through the whole man lftp(1) and it seems that the way you have chosen is actually the best one.
!command doesn't support direct combination with another commands, as you triedput < !find ...put,mputormirror.mirroris of no use for you as you noted, because it preserves the path.putormputcommands don't support any means to specify a file with list of files to upload.So, the only possibility is what you have: generate the script and use
sourceto run it.What you could try is to put all the files into one
mputcommand:but be careful: although I haven't found it in the docs, there might be limitation for maximum line size! So I think in the end your way is the best way to go.
Note that you can also code-golf your command to: