Code:
subprocess.call(["mv", "*.fasta", f"{my_model_dir}/."])
Error message:
mv: cannot stat '*.fasta': No such file or directory
I tried move all the fasta form of files to other directory. But, I got an error message. I think it's because '*' expression is used as a regular expression in Python so it's not working in this situation. To move files with python script to other directory, what should I do and if you have any suggestions plz let me know it. Thank you.
CodePudding user response:
try subprocess.call(["mv", "\*.fasta", f"{my_model_dir}/."])
CodePudding user response:
You can use the os or shutil library:
(How to move a file in Python?)
As for the files of the same type, you can cycle through them using os and then move them one by one.
os reference:
(https://www.geeksforgeeks.org/os-module-python-examples/)
