I am trying to move Txt files from one folder to another but I keep getting an error message stating "illegal characters in path". I think it's because of the * in the file name but how do i change it to except it?


string sourceFile = @"C:\\new1\*.txt";
string destinationFile = @"C:\\new2\*.txt";

try putting this....

string sourceFile = @"C:\\new1\\*.txt";
string destinationFile = @"C:\\new2\\*.txt";

Thanks Mono,

I have already tried this but haven't had any luck. It's not liking the "*" symbol but not sure what I can change it for or define in the code...

Please refrain from posting duplicate threads.
I have answered your problem in your original question.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.