I wrote the following code awhile back to export files from a corrupt site.
I also found it handy to calculate the size of a web (And see where the biggest web is in a site collection) to get around the following : (Error Messages When You Delete or Rename a Folder or Site in Windows SharePoint Services http://support.microsoft.com/default.aspx?scid=kb;en-us;827930 )
Hope this helps you, and you can use it for other apps as well!
Keith:
// BEGIN Sample.cs
using
namespace
{
[STAThread]
SPSite siteColl =
m_RecurseWebs =
m_RecurseFolders =
m_strExportDir = args[2].ToString();
lTotalSize = GetWebDetails(siteColl.RootWeb);
Console.WriteLine("Done!!!");
Console.WriteLine("Total size of all files in all folders is: " + lTotalSize);
}
Console.WriteLine("Analyzing web " + web.Name + " at location " + web.ServerRelativeUrl);
lWebTotal += GetFolderDetails(folder);
lWebTotal += GetWebDetails(subweb);
Console.WriteLine("Total size of all files in all folders for " + web.Name + " is: " + lWebTotal);
Console.WriteLine("Processing Folder " + folder.ServerRelativeUrl);
strPath = CheckPathAndCreate(folder.ServerRelativeUrl);
Console.WriteLine(" Exporting file " + file.Name + " to " + sFileLoc);
FileStream fs =
fs.Write(binFile,0,binFile.Length);
fs.Close();
lFolderSize += file.Length;
GetFolderDetails(subfolder);
strPath = ServerRelativeUrl.Replace("/","\\");
System.IO.Directory.CreateDirectory(m_strExportDir + strPath);
// END Sample.cs