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";

Recommended Answers

Perhaps you could take a look at this: [url]http://msdn.microsoft.com/en-us/library/cc148994.aspx[/url]

Jump to Post

All 4 Replies

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...

Be a part of the DaniWeb community

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