How to find file location using the regular expression ("*" in the path)?
Question:
Following cp
linux command is working fine to find a file "/home/temp/test-1.34.56/sample"
to current location
Shell command: Working fine
cp "/home/temp/test-*/sample" "./"
Python code:
It not working using os.rename
os.rename("/home/temp/test-*/sample", "./")
any other options ?
Answers:
Tried glob module from above @Wjandrea, @Tom, @Treuss comments. it worked
from glob import glob
import shutil
Actual_path = glob("/home/temp/test-*/sample")
shutil.move(Actual_path,"./")
Following cp
linux command is working fine to find a file "/home/temp/test-1.34.56/sample"
to current location
Shell command: Working fine
cp "/home/temp/test-*/sample" "./"
Python code:
It not working using os.rename
os.rename("/home/temp/test-*/sample", "./")
any other options ?
Tried glob module from above @Wjandrea, @Tom, @Treuss comments. it worked
from glob import glob
import shutil
Actual_path = glob("/home/temp/test-*/sample")
shutil.move(Actual_path,"./")