FTP Download on Task

Hello,
I build a Task for download a file from my ftp server.

I tried with
fileCopy(“ftp://#username#:#password#@#server#:#port#/#fineName#”, destinationPath );
an run correctly!

I tried with
var result = progressableDownloader.download(
‘ftp://#username#:#password#@#server#:#port#/#fineName#’,
destinationPath,
function( status ) {
progressBar.update( argumentCollection = status );
}
);

show this error:
No matching Method/Function for sun.net.www.protocol.ftp.FtpURLConnection.setInstanceFollowRedirects(boolean) found

C:\Users\Emanuele.CommandBox\cfml\system\util\ProgressableDownloader.cfc: line 198
196: // The reason we’re following redirects manually, is because the java class
197: // won’t switch between HTTP and HTTPS without erroring
198: connection.setInstanceFollowRedirects( false );

progressableDownloader is very beautiful, is it possible use this component for FTP protocol?

Commandbox is awesome, thank you for this tool!

Hi Emanuele,

I’m wondering if you might be better off using the cfftp function: https://cfdocs.org/cfftp

Then, once you download it, save it to where ever it needs to go.

Dan

The progressable download could probably be modified to work with FTP connections. I’m using some Java classes behind the scenes and I probably call some methods that are specific to the HTTP protocol. Would you like to put in a ticket for the enhancement and possibly take a stab at it? There are advantages to the download as it uses a progress bar and can be interrupted with Ctrl-C.

Thanks!

Ah, yes. Good point. Sorry for my arithmetic answer for a calculus question!

Done : https://ortussolutions.atlassian.net/projects/COMMANDBOX/issues/COMMANDBOX-947

I hope created ticket in right place :slight_smile:

There is some docs to help me for edit code cfc and test it in my pc?

I clone GIT repository on my PC, after edit cfc how to test if my ProgressableDownloader.cfc run correctly?

Thank you!

The ticket looks great. You can just edit the CFML files directly in the root of the .CommandBox/cfml/system folder and then run the “reload” command to pick up any changes. If you plan on doing a lot of CommandBox dev, clone the repo, delete the cfml directory from your CommandBox home and symlink in the cfml directory from the repo. Restart the shell and REVERT any changes to the webroot. Then you can just pull the latest changes in the repo to get the latest CFML code. This works great so long as I haven’t updated any of the jars, which would require a fresh box.exe.

Also, the equiv to dump() in the CLI is

systemOutput( myVar, true );

Note it handles complex values as well like structs and arrays.

Hey Brad,

That last message from you, factored a bit, would make a -stellar- blog entry on the Ortus site. Just sayin. :wink:

-nolan

Yes, I know :slight_smile: I’ve had it in mind to create some docs on hacking on the sources for a while.