I've been looking on the internet and all I find are "how to move one document library from one site to another". My question is, is there a PowerShell script where I can copy a document library, which contains files and folders that contains files, and put it in the same site. For example, I have a library called Large_Library and I want to copy its contents in the same site and call or rename the newly created document library Large_Library2. Is it possible?
-
Considered using drop off feature?– AkhoyCommented Oct 2, 2015 at 16:31
-
Could you please elaborate?– Nina GCommented Oct 2, 2015 at 16:39
-
en.share-gate.com/blog/…. Alternatively, have you also tried using the site content and structure wizard to copy? support.office.com/en-nz/article/…– AkhoyCommented Oct 2, 2015 at 17:02
-
1Drop off does is not a solution as I don't need to set rules to where a document needs to go once uploaded. I have thousands of files and files nested within folders in one library that I'm trying to copy into another for testing purposes. Hence, I was asking about PS because it would take hours doing it this way. In addition, within site content and structure, the option to copy all files and folders is not available and would assume it would take hours to do so. Please advise.– Nina GCommented Oct 2, 2015 at 17:24
Add a comment
|
1 Answer
You can do it either using GUI or powershell.
- 1st save the document library as template( with include content options)
- Create new document library using that template. But their are size limitation.
You can also do it via powershell.
- 1st export the document library using this command.
Export-SPWeb -Identity <SiteURL> -Path <Path and File Name> [-ItemUrl <URL of Site, List, or Library>] [-IncludeUserSecurity] [-IncludeVersions] [-NoFileCompression] [-GradualDelete] [-Verbose]
- Now import it using the powershell. Import-SPWeb -Identity -Path [-Force] [-NoFileCompression] [-Verbose]
-
I've looked at that method and just wondering can I do that in the same site? For example if I export LibraryA from constoso.com and import to same site, does that mean I'll have 2 LibraryAs in contoso.com?– Nina GCommented Oct 5, 2015 at 17:56
-
sorry for late reply( due to sick)...yes you can do it within same site collection. yes you will have two libraries.– Waqas Sarwar MVP ♦Commented Oct 6, 2015 at 14:37