I want to execute a simple scp command in a python script, copying files following a certain name pattern.
I'm executing the 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 that I have to escape the wildcard '*', which I'm doing..but still I get:
scp: /home/test/test2/test3/*last_processed_date*.txt: No such file or directory
I'm wondering what I'm doing wrong..
EDIT: It was a careless mistake from my side. I 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)