in reply to how copy dir in NET::SFTP

From the little exposure I have had to the Net:: protocols they seem to try to provide a low-level interface that implements the protocol, to be used as building blocks for people to actually write user friendly (hopefully) clients and servers in. Sometimes some more convenient subroutines are also thrown in. Which pretty much covers Net::SFTP. The real power of it is the low-level calls, not the simpler extras.

I think we have a tendancy to take for granted even the most basic of conveniences in these types of clients. For example, does the File Transfer Protocol (FTP) have an mput and mget designed in or is it actually something the client and server software implement? I know which way I would bet....

Anyway, as others have mentioned, you will either need to create the local directory yourself and then build a list of files to get one at a time or take a look at jdtoronto's suggestion of using Net::SFTP::Recursive.

If you have the time to learn and experiment I'd suggest trying to do it yourself -- you will come to a much better understanding of how SFTP works and (generalizing a bit) how other client/server based protocols actually work.