0

I need to select and download many folders stored on a computer that I only have access to with remote ssh connection. I create a list ("list.txt") to download only the folders of my interest, I tried using a "for" loop with

for i  in "list.txt"; do 
    scp -r /pwd/of/folder/of/origen/ /pwd/of/folder/destiny; 
done

But don´t read my list and dowload all folders, also I tried with

for i  in "list.txt"; do 
    rsync -Pavizuh /pwd/of/folder/of/origen/$i /pwd/of/folder/destiny; 
done

but send mensagge:

sent 29 bytes  received 20 bytes  98.00 bytes/sec

total size is 0  speedup is 0.00

rsync error: some files could not be transferred (code 23) at /System/Volumes/Data/SWE/macOS/BuildRoots/d7e177bcf5/Library/Caches/com.apple.xbs/Sources/rsync/rsync-55/rsync/main.c(996) [sender=2.6.9]

building file list ... 

rsync: link_stat "/Users/rtorres/daniela/Proyecto/Anotacion/Strain9998" failed: No such file or directory (2)

0 files to consider

What can I do ? Thanks !

Iguananaut
  • 21,810
  • 5
  • 50
  • 63
Daniell
  • 1
  • 1
  • Does this answer your question? [How do I copy a folder from remote to local using scp?](https://stackoverflow.com/questions/11304895/how-do-i-copy-a-folder-from-remote-to-local-using-scp) – bwdm Aug 24 '21 at 20:41
  • You're not reading the contents of `lists.txt`, you're using that as the filename to copy. – Barmar Aug 24 '21 at 20:43
  • You haven't specified the remote server name in either command. – Barmar Aug 24 '21 at 20:44
  • Not sure why the Python tag, that's not Python syntax. – bwdm Aug 24 '21 at 20:44

1 Answers1

0

You want the contents of "list.txt", not the literal name "list.txt".

for i  in $(cat list.txt); do 
    scp -r server:/pwd/of/folder/of/origen/$i /pwd/of/folder/destiny/$i
done
Tim Roberts
  • 48,973
  • 4
  • 21
  • 30