0

My code is:

subprocess.call(["mv", "*.fasta", f"{my_model_dir}/."])

And the error code I got was:

mv: cannot stat '*.fasta': No such file or directory

I tried moving all the fasta files to other directory, but, I got an error message.

I think it's because the '*' is used as a regular expression in Python, so it's not working in this situation. To move files with a Python script to other directory, what should I do?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
LoganLee
  • 145
  • 1
  • 10
  • Welcome to SO! Please read "[ask]" and "[mcve]" and their linked pages. Grammar is important on SO, so please avoid things like "plz" and use proper capitalization. – the Tin Man Feb 07 '22 at 05:56

1 Answers1

0

try subprocess.call(["mv", "\*.fasta", f"{my_model_dir}/."])

reza
  • 1,354
  • 1
  • 7
  • 25
  • 1
    See "[Explaining entirely code-based answers](https://meta.stackoverflow.com/q/392712/128421)". While this might be technically correct it doesn't explain why it solves the problem or should be the selected answer. We should educate along with helping solve the problem. – the Tin Man Feb 07 '22 at 05:53