Is it possible to use Javascript to invoke a FTP call to a specified URL and retrieve all files in this webdirectory?
...
Is it possible to use Javascript to invoke a FTP call to a specified URL and retrieve all files in this webdirectory?
...
Assuming you are talking about javascript in the browser, then this is not possible without some supporting server side code.
You can use javascript to make an ajax call to a server - the server can invoke FTP and retrieve a file list (or even the files) to the server. These can then be downloaded from the server.
9 years later things are much easier. Here is a standalone node.js example that shows how on the server side thing can be implemented with javascript theses days easily.
npm install
node index.js
index.js
// Test getting CSV Data from Deutscher Wetterdienst
const ftp = require('ftp')
var Client = require('ftp');
var c = new Client();
c.on('ready', function() {
c.list('/pub/CDC/derived_germany/soil/daily/recent/',function(err, list) {
if (err) throw err;
console.dir(list);
c.end();
});
});
// connect to localhost:21 as anonymous
c.connect({host:'ftp-cdc.dwd.de'});
package.json
{
"name": "ftp-test",
"version": "1.0.0",
"description": "ftp Test application",
"main": "index.js",
"dependencies": {
"ftp": "^0.3.10"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Wolfgang Fahl",
"license": "ISC"
}