How to redirect the result of the "! Find ..." command to place the lftp command

I want to put files from the result of the find command from lftp.

I tried:

$> lftp -u foo, sftp://bar
lftp foo@bar$> put < !find ./local -type f

But it didn’t work out !!

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 any other way !? I would like to use stdio redirection (pipe, stdin ...).

+5
source share
3 answers

I read the whole man lftp (1) and it seems that the option you have chosen is actually the best .

  • ! the team does not support direct combination with other teams as you tried put < !find ...
  • The only way to upload files is to use put, mputor mirror. mirrorit is useless to you, as you noted, because it preserves the path. Teams
  • put mput .

, - , : script source .

, mput:

!find ./local -type f | awk -v ORS=" " 'BEGIN{print "mput "}{print}' > /tmp/files.lftp

: , ! , - .

, :

!find ./local -type f -printf "put %p\n" > /tmp/files.lftp
+4
source -e find ./local -type f \| sed \'s/^\(.*\)$/put \"\1\"/\'

sed find (") a put. , , , , ,... , sed approliy, .

, (\) (|) , lsftp. sh -like, :

find ./local -type f | sed 's/^\(.*\)$/put "\1"/'
+3

local, plain mput :

lcd local && mput * */* */*/* */*/*/*
+1

All Articles