简体   繁体   中英

Handle files from ftp:// and file://

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.

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://

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM