FTP Download Multiple Files using PowerShell

22,456

Solution 1

In a batch I can quite simply use the ftp.exe and the mget command with wildcards??

You can do the same in Powershell if you want to.

For a more Powershell way, you can use the FTPWebRequest. See here: http://msdn.microsoft.com/en-us/library/ms229711.aspx. You can build on the example to download multiple files in a loop.

But bottomline is, you do not have to convert something you have in batch to Powershell. You can, if you want, but what you have in batch, especially when calling external programs, should work just as well.

Solution 2

There are multiple ways to achieve this. One is to use the System.Net.FtpWebRequest as shown in this example: http://www.systemcentercentral.com/BlogDetails/tabid/143/IndexID/81125/Default.aspx

Or there are /n Software NetCmdlets you can use:

http://www.nsoftware.com/powershell/tutorials/FTP.aspx

Solution 3

Another resource you might want to check: PowerShell FTP Client Module

http://gallery.technet.microsoft.com/scriptcenter/PowerShell-FTP-Client-db6fe0cb

Share:
22,456
John E
Author by

John E

Updated on July 09, 2022

Comments

  • John E
    John E almost 2 years

    I’m new to PowerShell and am trying to convert a batch file that downloads multiple files based on names and extension from a directory on an ftp site. While I’ve found several examples that download a file, I’m struggling to find one that shows how to download multiple files. In a batch I can quite simply use the ftp.exe and the mget command with wildcards??

    Can someone please point me in the right direction.

    Thanks in advance. John