FTP upload to Sourceforge with PowerShell

The release system of Sourceforge.net requires to upload your files by FTP to upload.sourceforge.net. The process is basically a pure pain, especially for small files:

Anyway, here below is a PowerShell script that I am using to upload files by FTP to sourceforge.net. Save this script into ftp2sf.ps1, then from the PowerShell command-line, just type .\ftp2sf.ps1 'myPackage.zip' and your file will get upload to sourceforge.net. Then, go through the sourceforge release interface and complete the process.

# Author: Joannès Vermorel # http://www.vermorel.com/
# # USAGE:
# .\ftp2sf.ps1 'myLocaFile'

Param( UploadFilePath=“filename”);UploadFilePath=“filename”);UploadFilePath = “filename” ); FtpUploadCommand = “PUT "" + $UploadFilePath + "”“;

$FtpCommandFilePath = [System.IO.Path]::GetFullPath(“FTPCommand.tmp”);

FtpCommands=@(“anonymous”,“myemail@example.com”,“cdincoming”,“bin”,“quotepasv”,FtpCommands=@(“anonymous”,“myemail@example.com”,“cdincoming”,“bin”,“quotepasv”,FtpCommands = @( “anonymous”, “myemail@example.com”, “cd incoming” , “bin”, “quote pasv”, FtpUploadCommand, “quit” );

FtpCommand=[String]::Join(“‘r‘n”,FtpCommand=[String]::Join(“‘r‘n”,FtpCommand = [String]::Join( “`r`n”, FtpCommands );

set-content FtpCommandFilePathFtpCommandFilePathFtpCommandFilePath FtpCommand;

ftp “-s:$FtpCommandFilePath” upload.sourceforge.net;

remove-item $FtpCommandFilePath;

Reader Comments (4)

[…] Das Script basiert auf einem Beispiel von Joannes Vermorel. Ich habe es nur ein wenig erweitert. Das fertige Script sieht nun wie folgt aus. Es benötigt lediglich einen Parameter: up oder down. […]April 6, 2007 | Einstieg in die PowerShell &ra

[…] Q: How do I FTP from PowerShell?A: Options:- Take a look at this script by Joannes Vermorel.- NetCmdlets http://www.nsoftware.com/powershell- Take a look at this script posted to the microsoft.public.windows.powershell newsgroup […] April 18, 2007 | Nino.Mobile : [name:CINNUGPowe

What does the line - FtpCommand=[String]::Join(“‘r‘n”,FtpCommands ); do? December 18, 2008 | Jim Phillips

The [String]::Join commands adds line returns at the end of each command. December 18, 2008 | joannes