How to export and import lists and libraries full version and permission
Exporting# specify the site URL to export
$web = Get-SPWeb "microsofttechnology.net/sites/sharepoint"
# specify output folder to store exported lists
$path = "D:\SharepointLists"
foreach($list in $web.lists)
{
"Exporting " + $list.RootFolder.URL
export-spweb $web.URL -ItemUrl $list.RootFolder.URL -IncludeUserSecurity -IncludeVersions All -path ($path + $list + ".cmp")
}
Importing
# specify target SharePoint site to import into
$site = "microsofttechnology.net/sites/sharepoint1"
# specify folder containing exported lists
$folder = "D:\SharepointLists"
$Files = Get-ChildItem $folder
foreach ($file in $files)
{
$name = $file.Name
"Importing: " + "$folder$name"
import-spweb $site -path ("$folder$name") -includeusersecurity –UpdateVersions Overwrite
}