unix - Using wildcards in filename in scp in python -


i want execute simple scp command in python script, copying files following name pattern.

i'm executing following command:

filename = '\*last_processed_date\*.txt' command = ''' scp test@100.41.14.27:/home/test/test2/test3/%s %s '''\                       % (filename,self.unprocessed_file_dir) os.system(command) 

i understand have escape wildcard '*', i'm doing..but still get:

scp: /home/test/test2/test3/*last_processed_date*.txt: no such file or directory 

i'm wondering i'm doing wrong..

edit: careless mistake side. should have done:

command = ''' scp 'test@100.41.14.27:/home/test/test2/test3/%s' %s ''' 

instead of:

command = ''' scp test@100.41.14.27:/home/test/test2/test3/%s %s '''\                           % (filename,self.unprocessed_file_dir) 

this works on system:

host = 'test@100.41.14.27' filename = '*last_processed_date*.txt' rpath = '/home/test/test2/test3' lpath = self.unprocessed_file_dir command = 'scp %s:%s/%s %s' % (host, rpath, filename, lpath) os.system(command) 

if gives error, try on terminal first:

ssh test@100.41.14.27 ls /home/test/test2/test3/*last_processed_date*.txt 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -