public override void Work(FileOperation job) { File.Delete(job.Source); string dir = job.Source; while (!string.IsNullOrEmpty(dir = Path.GetDirectoryName(dir))) { if ((Directory.GetFiles(dir).Length == 0) && (Directory.GetDirectories(dir).Length == 0)) Directory.Delete(dir); else break; } }
public override void Work(FileOperation job) { Directory.CreateDirectory(Path.GetDirectoryName(job.Destination)); if(File.Exists(job.Destination)) { // Check if the sizes are the same and skip copying if it is. FileInfo srcInfo = new FileInfo(job.Source); FileInfo destInfo = new FileInfo(job.Destination); if (srcInfo.Length == destInfo.Length) return; } File.Copy(job.Source, job.Destination, true); }
public abstract void Work(FileOperation job);
public FileOperationEventArgs(int progress, FileOperation job) { this.Progress = progress; this.Job = job; }