public void PreMakeDir() { DirectoryInfo directory = new DirectoryInfo(Source_FBDResults); DirectoryInfo DestDir = new DirectoryInfo(Dest_FBDResults); DirectoryInfo[] DList = directory.GetDirectories("*", SearchOption.AllDirectories); foreach (var D in DList) { string D2 = D.FullName; string D3 = D2.Replace(directory.ToString(), DestDir.ToString()); string D4 = D2.Replace(directory.ToString(), ""); DirectoryInfo mdir = new DirectoryInfo(D3); mdir.Create(); RTBOutput.AppendText(Environment.NewLine + D2 + " making " + D3); RTBOutput.ScrollToEnd(); CComplet = CComplet + 1; TB_CompletedCount.Text = CComplet.ToString(); MainPB.Value = CComplet; } }
public void copyer(string ffname, string fname) { DirectoryInfo DestDir = new DirectoryInfo(Dest_FBDResults); DirectoryInfo SorceDir = new DirectoryInfo(Source_FBDResults); string SNameDir1 = ffname.Replace(fname, ""); string SNamedir2 = SNameDir1.Replace(SorceDir.ToString(), DestDir.ToString()); string NFName = SNamedir2 + fname; if (System.IO.Directory.Exists(SNamedir2)) { System.IO.File.Copy(ffname, NFName, Overwrite); RTBOutput.AppendText(Environment.NewLine + ffname + " Copy to " + NFName); } }
public void Filecount() { if (CB_Recursive.IsChecked == true) { try { SDirCount = Directory.GetFiles(Source_FBDResults, "*.*", SearchOption.AllDirectories).Length; DirCount = Directory.GetDirectories(Source_FBDResults, "*", SearchOption.AllDirectories).Length; totelCount = SDirCount + DirCount; } catch (UnauthorizedAccessException) { string logMsg = string.Format("Unable to access directory {0}", Source_FBDResults); RTBOutput.AppendText(Environment.NewLine + logMsg); RTBOutput.AppendText(Environment.NewLine + "Please try Running me as Adminstrator"); } catch (ArgumentNullException) { } } else { try { totelCount = Directory.GetFiles(Source_FBDResults, "*.*", SearchOption.TopDirectoryOnly).Length; } catch (UnauthorizedAccessException) { string logMsg = string.Format("Unable to access all the files in directory {0}", Source_FBDResults); RTBOutput.AppendText(Environment.NewLine + logMsg); RTBOutput.AppendText(Environment.NewLine + "Please try Running me as Adminstrator"); } catch (ArgumentNullException) { } } TBFileCount.Text = totelCount.ToString(); }
private void WarrningMessage() { RTBOutput.AppendText(Environment.NewLine + "You Hit the Big Red Button!! Do you know what you just DID?"); RTBOutput.AppendText(Environment.NewLine + "Begining the File Copy Proccess ... "); RTBOutput.AppendText(Environment.NewLine + "Please Wait for the Proccess to Finish"); }