Like my previous post, Purging a SharePoint list of all items and folders, here is another quick peice of code that will allow you to either Import a file system folder (And all files and subfolders) into a SharePoint Document Library, and also export a SharePoint Document Library to the file system.
I had a SPExportWebFiles tool in the old Utility Suite that did the exporting, and an Import feature in SPSiteBuilder. I’ve been waiting to find the time or opportunity to provide both a sample/tool that provided both import and export, and ran into that need today🙂 So, I thought I’d share.
The code contained in this file: SPIEFolder.txt, contains sample code to do just that, and create the nested folders as necassary to match the target location.
This code should work with either WSS 2.0/SPS2003 or WSS 3.0/MOSS 2007 without change. (I’ve only tested on WSS 3.0/MOSS btw at this time)
(Update 06-02-2011: See this link SPIEFolder 1.0 removed and SPIEFolder for SharePoint 2010 is now published at http://blog.krichie.com/my-sharepoint-tools/#spiefolder)
So, got a folder you want to import into a SharePoint Document Library and you want to replicate the folder heirarchy and contents? Or, want to export a SharePoint Document Library and replicate the folder heirarchy and contents on the file system? This could help!
Hopefully this weekend, I’ll have some time to provide compiled versions, build scripts, and documentation like SPLSBackup for both this and the List Purging code as noted in my previous post. But I doubt very seriously that the document will be as extensive as SPLSBackup🙂, as I don’t see a big need for that🙂.