I have a document library with documents. And there is a subsite with the same list. I want to move the documents from the part library to the subsite library.

Is this possible to do with the powershell .MoveTo() command?

Error is

Exception calling "MoveTo" with "2" argument(s): "Folder "MyLib" does not exist."
At C:\script\archive3.ps1:131 char:27
+             $spFile.MoveTo <<<< ($destLoc, $true);
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException
  • 1
    Can you include your code as well? Commented Jun 4, 2015 at 18:57
  • code is requirement or you can do it via GUI?
    – Waqas Sarwar MVP
    Commented Jun 4, 2015 at 19:26

2 Answers 2


You cannot do that with SPFile.MoveTo().

MoveTo() is limited to the same site only (see remark in the MSDN article). So, if you want to move file to the subsite you have to that with some more code.

And indeed the error message is misleading.


I'm not sure about the .moveTo() command specifically but you can script the action. Review the answer posted to a similar question here: Move files between document libraries in the same Site Collection (#2)

You may also want to just consider opening each library in windows explorer and just manually moving those items (if it's just a one time operation).

  • Does it have to be in same site? Cause I'm moving to subsite
    – omega
    Commented Jun 4, 2015 at 19:08

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.