0

Hi I am looking to rsync some files in a remote machine locally. there are several files but only need specific numbered files from a list. for example, lets say I have a list of files:

file0001
file0002
file0003
.
.
.
file0101
file0102

but would only need to import say files numbered file0023, file0025, and file0103.

I tried making a python script with a for loop that loops through a tuple with these specific numbers. the issue is there are several dozens of files I need to rsync among hundreds and cannot be putting the ssh password every time. ( using ssh keys doesnt work with the remote machine I am using).

I shortened the list of the code so it looks as follows:

list = (,'0074',
    '0080',
    '0125',
    '0322',
    '0323',
    '0324',
    '0325',
    '0326',
    '0328',
    '0329')
 

for number in list:
    os.system("rsync -rv host:path/to/directory/file"+number+" local/directory")

Thank you for your help!

Edit: fixed syntax

Nihrion
  • 5
  • 4
  • Take a look at option `--files-from` to read list of source-file names from a file. See `man rsync`. – Cyrus May 25 '21 at 09:59
  • does this mean I should make a list (txt file) with the numbered files and have rsync read from there? – Nihrion May 25 '21 at 10:07

0 Answers0