Home > Mobile >  rsync files from different path
rsync files from different path

Time:08-19

I need to copy files from remote server (different path) to local path

Iget file list in this working way:

ssh user@remote " ls -R /path/  \
" |grep "o1_" | awk -F '_' '{if ($4 > 55146) print $0}'  >file_list.txt

or

ssh user@remote " find /path/  " \
|grep "o1_" | awk -F '_' '{if ($8 > 55152) print $0}' >files_full_path.txt

example files_full_path.txt

/path/path1/file1 
/path/path1/file2
/path/path2/file3 
/path/path2/file4 

I've tried with full or non full path without success, examples below:

rsync -aver --include-from=files_full_path.txt user@remote:/path/ /destination_path

rsync -ave --include-from=files_full_path.txt --include /path/ --exclude='/*/' /path/

Can you help me?

Thanks

CodePudding user response:

Perhaps this will help you:

$ ssh user@remote touch 1 2
$ mkdir 12
$ echo -e "1\n2" | rsync --include-from=- user@remote:\* 12/
$ ls 12 | cat
1
2

CodePudding user response:

I'have found solution

cat to_apply.txt |xargs -i scp user@host:{} destination_path/

  • Related