How to get a series of files from an FTP server using C #

I am stuck at the point where I am using a substitution parameter with FtpWebRequest object as suck

   FtpWebRequest reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/" + WildCard));

      

now it works fine, however now I want to get a specific range of files.

say the file naming structure *YYYYMMDD.*

and I need to get all the files up to today.

I was looking for a pattern template for this with no good results that would work on a simple list of files.

and it doesn't look like I can use regex here.

any thoughts?

+2


source to share


1 answer


The FTP RETR

(extract) command does not support wild cards.

You will need to get LIST

all the files, iterate over them, and get only the ones that follow the pattern you want.



RFC 959 does not specify wild cards, but simply specifies what <pathname>

should be passed to the command RETR

.

+3


source







All Articles