Contributors

Wednesday 21 May 2014

Import-SPWeb: The directory does not exist

So you've exported a site or list and then when attempting to Import it again, you get an error saying that the directory you are importing from does not exist. WTF, right?

My error is below:

Import-SPWeb : The directory D:\Test\Test.cmp does not exist.
At line:1 char:1
+ Import-SPWeb -identity http://testsite -Path "D:\Test\Test.cmp"
-NoFi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...CmdletImportWeb:
   SPCmdletImportWeb) [Import-SPWeb], SPException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletImportWe
   b

So I ran the export from Central Administration but I did say to include all versions. I did not check the user security box (which in reality I should have done!), but the problem here was that I did not have FileCompression on in the export from Central Admin. I added that switch to the cmdlet. So the Import would not work for that reason. I tried running:

Import-SPWeb -identity -Path -NoFileCompression

Simply removing -NoFileCompression solved the issue and it imported.

Little road block that might annoy you!! :)

5 comments:

  1. Holy cow thank you for this!

    ReplyDelete
  2. Great :) It worked ! Thanks a lot !

    ReplyDelete
  3. thanks. it worked. you save my afternoon

    ReplyDelete
  4. I add -NoFileCompression then import-spweb says to me "The directory does not exist", I delete -NoFileCompression and get the error "The file does not exist".

    ReplyDelete