I have a lot of files in /home/somedir/subdir/ and I\'m trying to move them all up to /home/somedir programmatically.
right now I have this:
subprocess.c
You can solve this by adding the parameter shell=True
, to take into account wildcards in your case (and so write the command directly, without any list):
subprocess.call("mv /home/somedir/subdir/* somedir/", shell=True)
Without it, the argument is directly given to the mv
command with the asterisk. It's the shell job to return every files which match the pattern in general.