I would like to create a simple copy console application (I know copy already exists in DOS). Exactly like the DOS copy command I would like to be able to execute my copy application with two simple arguments:
copy C:\Users\Admin\Samples\*.pdf C:\
- Input path and search pattern
- Ouput path
In my code I use this
static void Main(string[] args)
{
string input;
string output;
var options = new Options();
ICommandLineParser parser = new CommandLineParser();
if (parser.ParseArguments(args, options))
{
input = options.Argument[0];
output = options.Argument[1];
// Get file list
String directory = Path.GetDirectoryName(input);
String[] files = Directory.GetFiles(directory, /* ??? */);
// To be continued...
}
else
{
System.Console.WriteLine("Erreur");
System.Console.ReadKey();
}
}
How can I easely retrieve my search pattern? Is beter way to do this?
Try this:
I think this is what you wanted.