Getting file list on ftp server

Cem_KaraerCem_Karaer Member Posts: 281
Hello, I want to get a list of files on FTP server giving a file pattern. For example I want to get a list of files matching following pattern: /matmaster/MATMASTER_*.CSV

Why do I want this? Because it is not allowed for us to make any file movement on the remote server. So we have to check none-downloaded files on the FTP and download if exists.

Is there any dotnet solution for this?
Cem Karaer @ Pargesoft
Dynamics NAV Developer since 2005

Best Answer

Answers

  • Cem_KaraerCem_Karaer Member Posts: 281
    @bbrown, thanks a lot. It seems good. I will try and post the result.
    Cem Karaer @ Pargesoft
    Dynamics NAV Developer since 2005
  • Cem_KaraerCem_Karaer Member Posts: 281
    Nice approach really, here is a link listing available options for FtpWebRequest.Method

    https://msdn.microsoft.com/en-us/library/system.net.webrequestmethods.ftp_fields(v=vs.110).aspx
    Cem Karaer @ Pargesoft
    Dynamics NAV Developer since 2005
  • bbrownbbrown Member Posts: 3,268
    https://en.wikipedia.org/wiki/List_of_FTP_commands

    This provides a listing of the 4 character commands needed for the above process. Not all of the commands are supported. That, I think is just trial and error. I'm thinking only the RFC 959 commands are supported, but can't say for sure.
    There are no bugs - only undocumented features.
  • bbrownbbrown Member Posts: 3,268
    Also note that I am using the assembly "System.Net.FtpWebRequest" and not "System.Net.WebRequestMethods".
    There are no bugs - only undocumented features.
  • Cem_KaraerCem_Karaer Member Posts: 281
    edited 2017-10-04
    Hello, FtpWebRequest is derived from WebRequest and I think Method is not overriden in FtpWebRequest so the link is revelant actually.
    Cem Karaer @ Pargesoft
    Dynamics NAV Developer since 2005
Sign In or Register to comment.