1

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?

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

2

try to use cmd1 = ["cmd", "/c", "move", spath, npath]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.