Tuesday 10 June 2014

Import-SPWeb: The directory does not exist

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, 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://mytestsite -Path D:\Test\Test.cmp -NoFileCompression -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + 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 http://mytestsite -Path D:\Test\Test.cmp  -Force


Simply removing -NoFileCompression solved the issue and it imported. J

Enjoy Coding.. J