public void Execute(IExecutable command) { var files = Directory.EnumerateFiles(directory.FullName).Select(f => new FileInfo(f)); foreach (var f in files) { command.Process(f); } if (IsRecursive) { var directories = Directory.EnumerateDirectories(directory.FullName); foreach (var dir in directories) { var fw = new FileWorker(dir, true); fw.Execute(command); } } }
public void Execute(IExecutable command) { var result = new List <string>(); var currentDirectory = new DirectoryInfo(path); if (currentDirectory.Exists) { var availableFiles = new List <FileInfo>(currentDirectory.GetFiles()); if (isRecursive) { GetAllFiles(currentDirectory, availableFiles); } foreach (var file in availableFiles) { result.Add(ConvertPath(file) + " : " + command.Process(file)); } SaveResult(result); } }