Here is the scenario. You create a sub-site and start building all of your lists, libraries, and other content, only to find that this site should be a top-level or at some other location other than where it’s currently at.
Using SharePoint Powershell and the ‘stsadm’ command to perform an Export and Import this can easily be accomplished. Below are the steps I used to successfully move a sub-site from one level to another.
To Export a Site, at the PowerShell prompt type:
stsadm -o export -url http://sharepointsite/sub_site_01/sub_site_12 -filename c:\backup\sharepointsite.bak -includeusersecurity -versions 4 –nofilecompression
To Import a Site, at the PowerShell prompt type:
stsadm –o import –url http://sharepointsite/sub_site_12/ -filename c:\backup\sharepointsite.bak –includeusersecurity
Here is some additional information regarding the various options for the Import and Export commands.
stsadm.exe -o export -url <URL to be exported> -filename <export file name> [-overwrite] [-includeusersecurity] [-haltonwarning] [-haltonfatalerror] [-nologfile] [-versions <1-4> 1 - Last major version for files and list items (default) 2 - The current version, either the last major or the last minor 3 - Last major and last minor version for files and list items 4 - All versions for files and list items] [-cabsize <integer from 1-1024 megabytes>] [-quiet]
stsadm.exe -o import -url <URL to import to> -filename <import file name> [-includeusersecurity] [-haltonwarning] [-haltonfatalerror] [-nologfile] [-updateversions <1-4> 1 - Add new versions to the current file (default) 2 - Overwrite the file and all its versions (delete then insert) 3 - Ignore the file 4 - Terminate with conflicts] [-quiet]