A
A
AleksRep2022-03-25 13:09:05
linux
AleksRep, 2022-03-25 13:09:05

How to copy multiple scp files?

Through find I get a list of files from a remote computer via ssh, put them in the $lists variable.
Next, I want to copy them to the local computer.

scp -r -i ~/.ssh/key [email protected]:$lists ~/dir/

copies the first file, gives an error on the following:
cp: cannot stat '/home/files/3.txt': No such file or directory
cp: cannot stat '/home/files/4.txt': No such file or directory

What's wrong, thanks.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Victor Taran, 2022-03-25
@shambler81

mkdir /tmp/11
Now all that remains for us on the server from which we are copying is to execute 1 command.
tar cvfz - /home/bitrix/ext_www/site.ru.ru/upload/mail/ |ssh [email protected] "cd /tmp/11;tar xvfz -"
will compress everything into 1 file and stream it to that server by unpacking it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question