Search code examples
c#.netsshsharpssh

Get a remote file on SFTP with only knowing part of the file name


Okay, well I have the whole file name but the client decided to include timestamps to the end of each name so it really got me confused on how to do this. It was previously a static name plus the current date..

e.g. CompanyNameOBound2012224.zip

I accomplished this simply..

filename = "CompanyNameOBound" + yr + month + day + ".zip"

But now they included a time stamp..

e.g. CompanyNameOBound2012224701611.zip

Any ideas on how to tackle this? Thanks


Solution

  • I think you will need to fetch a list of all files in dir using sharpssh's GetFileList, and then perform checks to see which file(s) you want.

    You might like to look at this question: Sharpssh directory listing