static void Main(string[] args) { //string dir = ProductionToApplicationCopierExtractor.Properties.Settings.Default.LogDirectory.ToString(); string dir = "R:\\Bannerlogs\\2013\\01"; DirFileClass dfc = new DirFileClass(); Extraction exact = new Extraction(); exact.ExtractFilesInDirectory(dir); Properties.Settings.Default.LastDirectoryImported = exact.LastFileUnzipped; Properties.Settings.Default.Save(); Console.ReadKey(); }
private void ProcessFolder(string FolderToSearch, bool keepFile) { Semaphore semapool = new Semaphore(4, 4); DirectoryInfo FolderToSearchInfo = new DirectoryInfo(FolderToSearch); FileInfo[] files = FolderToSearchInfo.GetFiles("*.txt"); Console.WriteLine(files.Length); foreach (FileInfo fi in files) { semapool.WaitOne(); string[] brokenfilename = BrokenUpFileName(fi.Name); switch (brokenfilename[5].ToString().ToLower()) { case "user": StoreImpressions(fi); break; case "interaction": StoreInteractions(fi); break; case "session": //StoreImpressions(fi, TrackingType.Sessions); //break; default: break; } //remove the file if necessary DirFileClass fc = new DirFileClass(); if (keepFile == false) { fi.Delete(); Console.WriteLine(String.Concat("Deleting ", fi.FullName)); } else { if (FolderToSearch.Substring(FolderToSearch.Length - 1) != "\\") { FolderToSearch = string.Concat(FolderToSearch, "\\"); } string ProcessedLogFolder = string.Concat(FolderToSearch, "done\\"); fc.DirectoryName = "ProcessedLogFolder"; if (fc.DirectoryExists() == false) { fc.CreateDirectory(); } fi.MoveTo(string.Concat(ProcessedLogFolder, fi.Name)); } Thread.Sleep(250); semapool.Release(); } Thread.Sleep(5000); }