Reputation: 1617
I am tring to call the cmd command "move" from python.
cmd1 = ["move", spath , npath]
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
p = subprocess.Popen(cmd1, startupinfo=startupinfo)
While the comammand works in the cmd. I can move files. With this python code i get:
WindowsError: [Error 2] The system cannot find the file specified
Spath and npath, are absolute paths to folders, so being in another directory should not matter.
[edit] Responding to Tim's answear: The how do i move a folder?
Upvotes: 1
Views: 1311
Reputation: 336108
move
is built-in into the cmd
shell, so it's not a file command that you can call this way.
You could use shutil.move()
, but this "forgets" all alternate data stream, ACLs etc.
Upvotes: 3