<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.twig.es/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.twig.es/index.php?action=history&amp;feed=atom&amp;title=Using_Powershell_for_ftp_3</id>
		<title>Using Powershell for ftp 3 - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.twig.es/index.php?action=history&amp;feed=atom&amp;title=Using_Powershell_for_ftp_3"/>
		<link rel="alternate" type="text/html" href="https://wiki.twig.es/index.php?title=Using_Powershell_for_ftp_3&amp;action=history"/>
		<updated>2026-05-06T14:01:56Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.0</generator>

	<entry>
		<id>https://wiki.twig.es/index.php?title=Using_Powershell_for_ftp_3&amp;diff=2349&amp;oldid=prev</id>
		<title>George2: Created page with &quot;&lt;source lang=&quot;powershell&quot;&gt;    $Username = &quot;FTPUSER&quot; $Password = &quot;testPassw0rd&quot;  #hash with source and destination path $list =@{ &quot;ftp://myftpserver.com/files/file1.zip&quot;=&quot;C:\te...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.twig.es/index.php?title=Using_Powershell_for_ftp_3&amp;diff=2349&amp;oldid=prev"/>
				<updated>2015-08-06T12:34:00Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;    $Username = &amp;quot;FTPUSER&amp;quot; $Password = &amp;quot;testPassw0rd&amp;quot;  #hash with source and destination path $list =@{ &amp;quot;ftp://myftpserver.com/files/file1.zip&amp;quot;=&amp;quot;C:\te...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$Username = &amp;quot;FTPUSER&amp;quot;&lt;br /&gt;
$Password = &amp;quot;testPassw0rd&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#hash with source and destination path&lt;br /&gt;
$list =@{ &amp;quot;ftp://myftpserver.com/files/file1.zip&amp;quot;=&amp;quot;C:\temp\dest1.zip&amp;quot;;&amp;quot;ftp://myftpserver.com/files/file2.zip&amp;quot;=&amp;quot;C:\temp\dest1.zip&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
$list | % {&lt;br /&gt;
&lt;br /&gt;
	$LocalFile = $_.value&lt;br /&gt;
	$RemoteFile = $_.name&lt;br /&gt;
	 &lt;br /&gt;
	# Create a FTPWebRequest&lt;br /&gt;
	$FTPRequest = [System.Net.FtpWebRequest]::Create($RemoteFile)&lt;br /&gt;
	$FTPRequest.Credentials = New-Object System.Net.NetworkCredential($Username,$Password)&lt;br /&gt;
	$FTPRequest.Method = [System.Net.WebRequestMethods+Ftp]::DownloadFile&lt;br /&gt;
	$FTPRequest.UseBinary = $true&lt;br /&gt;
	$FTPRequest.KeepAlive = $false&lt;br /&gt;
	# Send the ftp request&lt;br /&gt;
	$FTPResponse = $FTPRequest.GetResponse()&lt;br /&gt;
&lt;br /&gt;
	# Get a download stream from the server response&lt;br /&gt;
	$ResponseStream = $FTPResponse.GetResponseStream()&lt;br /&gt;
&lt;br /&gt;
	# Create the target file on the local system and the download buffer&lt;br /&gt;
	$LocalFileFile = New-Object IO.FileStream ($LocalFile,[IO.FileMode]::Create)&lt;br /&gt;
	[byte[]]$ReadBuffer = New-Object byte[] 1024&lt;br /&gt;
&lt;br /&gt;
	# Loop through the download&lt;br /&gt;
		do {&lt;br /&gt;
			$ReadLength = $ResponseStream.Read($ReadBuffer,0,1024)&lt;br /&gt;
			$LocalFileFile.Write($ReadBuffer,0,$ReadLength)&lt;br /&gt;
		}&lt;br /&gt;
		while ($ReadLength -ne 0)&lt;br /&gt;
&lt;br /&gt;
	$LocalFileFile.close()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>George2</name></author>	</entry>

	</feed>