public static void BackupAll(string dataStoragePath, ReportLogDelegate reportLog)
{
try
{
dataStoragePath = Path.GetFullPath(dataStoragePath); // normalize path
{
var now = DateTime.UtcNow;
var sessions = DataReader.GetSessionsFromPath(dataStoragePath, TimePeriod.Unlimited);
foreach (var session in sessions)
{
if (now - session.LastUpdateTime < NonArchivePeriod)
continue;
try
{
reportLog(string.Format("Archiving {0}", session.FileName));
ArchiveFile(session.FileName);
}
catch (Exception exc)
{
reportLog(exc);
}
}
}
MoveOldZipFiles(dataStoragePath);
reportLog("Finished ok");
}
catch (Exception exc)
{
reportLog(exc);
}
}