I have a list of files: /location/file.txt
Content of file:
/location1/file2.abc
/location2/location3/file1.abc
/location4/location5/fileX.cde
I'd like to copy files to another sever like this:
cat /location/file.txt | xargs -i scp {} user@server:/location
but in the above example all of files from the list are copying to specific location, while I'd like to copy them to the same locations (accurate path as in the txt file /location1/, /location2/location3/ etc.
How can I do it? I can also use rsync, but I'd like to enter password (to remote server) only once.
ssh-agent
andssh-add
to enter the key's password only once.