node.js程式如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | var Client = require('ftp'); var fs = require('fs'); var c = new Client(); c.connect({ host: "10.0.1.1", user: "test", password: "test" }); c.on('ready', function() { c.put('BackupLog.txt', 'Remote/BackupLog.txt', function(err) { if (err) throw err; c.end(); }); }); |