How to use regular experession inside function?
<p>I am using following python script to copy files between windows machines.</p>

<pre><code>from subprocess import call

def copy_logs():
    file= '.\pscp.exe -pw test123 C:\Users\Administrator\Desktop\interact.* Administrator@1.1.1.1:/'
    call(file)

copy_logs() 
</code></pre>

<p>If I run the above script, I'm getting following error:</p>

<pre><code>PS C:\Users\Administrator\Desktop&gt; python .\execute_pscp.py
C:\Users\Administrator\Desktop\interact.*: No such file or directory

PS C:\Users\Administrator\Desktop&gt;
</code></pre>

<p>But if i specify filename exactly as "file= '.\pscp.exe -pw test123 C:\Users\Administrator\Desktop\interact_python.py  Administrator@1.1.1.1:/'", its working perfectly as shown below.</p>

<pre><code>PS C:\Users\Administrator\Desktop&gt; python .\execute_pscp.py
interact_python.py        | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
PS C:\Users\Administrator\Desktop&gt; 
</code></pre>

<p>But I want to use some regular expression inside the command "interact.*". So that I can copy some particular file/files.</p>

<p>And also I want execute this script every three hours. its there any way in python to achieve this?</p>

<p>I tried "import os" module as shown below. Its working perfectly.</p>

<pre><code>import os

def copy_logs():
    os.system(".\pscp.exe -pw test123 C:\Users\Administrator\Desktop\interact_pyth* Administrator@1.1.1.1:/")

copy_logs()
</code></pre>

python python-2.7