Reputation: 6273
I'll make a program that can collect files from anywhere. In the configuration, I should be able to enter filpattern in following forms:
c:\aaa\bbb\cc\aaa*.txt
ftp://user:password@host/ddd/eee/*.dat
Is there any class in .NET that can handle both these cases, or do I have to handle ftp:// and file:// separately?
Edit:
I also have to remove them after I've read them.
Upvotes: 3
Views: 134
Reputation: 31071
Call WebRequest.Create with your URL. That will return a class derived from WebRequest
of the appropriate type. You can detect the actual type and cast appropriately to handle the different download protocols. It understands the following URL schemes:
http://
https://
ftp://
file://
Upvotes: 1