I am Joannes Vermorel, founder at Lokad. I am also an engineer from the Corps des Mines who initially graduated from the ENS.

I have been passionate about computer science, software matters and data mining for almost two decades. (RSS - ATOM)

« What's wrong with PAD files | Main | WetPaint is far too expensive, migrate or die »

FTP upload to Sourceforge with PowerShell

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

  • is slow, is slow too.

  • you need to process your files by FTP whereas it could have been done much more easily through a simple web upload (at least for file that are less then 5MB which must account for 99% of the file released on sourceforge anyway).

  • if you want to re-upload your file, then you cant do it by FTP; you need to go through the web UI: first release the uploaded file, then delete the released file and finally re-upload your file (the process is maddening).

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

# Author: Joannès Vermorel
# .\ftp2sf.ps1 'myLocaFile'

Param( $UploadFilePath = "filename" );

$FtpUploadCommand = "PUT `"" + $UploadFilePath + "`"";

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

$FtpCommands = @( "anonymous", "", "cd incoming" , "bin", "quote pasv", $FtpUploadCommand, "quit" );

$FtpCommand = [String]::Join( "`r`n", $FtpCommands );

set-content $FtpCommandFilePath $FtpCommand;

ftp "-s:$FtpCommandFilePath";

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. [...]

[...] Q: How do I FTP from PowerShell?A: Options:- Take a look at this script by Joannes Vermorel.- NetCmdlets Take a look at this script posted to the newsgroup [...]

What does the line - $FtpCommand = [String]::Join( “`r`n”, $FtpCommands ); do?

December 18, 2008 | Unregistered CommenterJim Phillips

The [String]::Join commands adds line returns at the end of each command.

December 18, 2008 | Unregistered Commenterjoannes
Comments for this entry have been disabled. Additional comments may not be added to this entry at this time.