gouldopfl has asked for the wisdom of the Perl Monks concerning the following question:

I have been using Net::FTP::Recursive. They are now changing our server to SFTP only. In the current program that I use to pull the directory listing, I'm using the rdir attribute. It pulls a listing like

/########/ST_(en)/_20150109 d /########/ST_(en)/_20150206 d /########/ST_(en)/_20150306 d /########/ST_(en)/_20150407 d /########/ST_(en)/_20150507 d /########/ST_(en)/_20150610 d /########/ST_(en)/_20150708 d /########/ST_(en)/_20150810 d /########/ST_(en)/_20150910 d /########/ST_(en)/_20151012 d /########/ST_(en)/_20151111 d /########/ST_(en)/_20151211 d /########/ST_(en)/_20160111 d /########/ST_(en)/_20160210 d /########/ST_(en)/_20160309 d /########/ST_(en)/_20160411 d /########/ST_(en)/_20160509 d /########/ST_(en)/_20160610 d /########/ST_(en)/_20160711 d /########/ST_(en)/_20160810 d /########/ST_(en)/_20160912 d /########/ST_(en)/_20161010 d /########/ST_(en)/_20150109/Database.zip f /########/ST_(en)/_20150206/Database.zip f /########/ST_(en)/_20150306/Database.zip f /########/ST_(en)/_20150407/Database.zip f /########/ST_(en)/_20150507/Database.zip f /########/ST_(en)/_20150610/Database.zip f /########/ST_(en)/_20150708/Database.zip f /########/ST_(en)/_20150810/Database.zip f /########/ST_(en)/_20150910/Database.zip f /########/ST_(en)/_20151012/Database.zip f /########/ST_(en)/_20151111/Database.zip f /########/ST_(en)/_20151211/Database.zip f /########/ST_(en)/_20160111/Database.zip f /########/ST_(en)/_20160210/Database.zip f /########/ST_(en)/_20160309/Database.zip f /########/ST_(en)/_20160411/Database.zip f /########/ST_(en)/_20160509/Database.zip f /########/ST_(en)/_20160610/Database.zip f /########/ST_(en)/_20160711/Database.zip f /########/ST_(en)/_20160810/Database.zip f /########/ST_(en)/_20160912/Database.zip f /########/ST_(en)/_20161010/Database.zip f

I need to find a way to do the same thing using SFTP. Any suggestions. In this case the formatting of the file listing is relatively important to not needing to make major changes elsewhere. The remote server is a Windows server with the directory structure in Unix mode.

Replies are listed 'Best First'.
Re: FTP->SFTP directory listing
by choroba (Cardinal) on Oct 21, 2016 at 14:18 UTC
      I am not a Perl programmer. This program is used in a shell script for a process that I am responsible for but was written long before my time of taking over this process. So to be clear, I would still use the NET::SFTP::Recursive module, but which method would I call with the information you presented? Best Regards.

        stevieb already posted a reply with code, so maybe you can try that code and maybe tell us how that code does not apply to your situation.

        Note that this site is mostly a site for Perl programmers or people wanting to learn about Perl. Usually we don't write code on request, so if the code already posted doesn't accomplish what you need, you will have to become a Perl programmer.