javascript - Check what files are present in remote directory with grunt -
i'm looking way check files present in remote directory want access via ssh or similar , write filenames array.
so far had no luck. unix rsync has -n flag can print every file present @ destinated location, don't how use rsync-output in grunt.
here's how might via sftp ssh2
:
var ssh2 = require('ssh2'); var conn = new ssh2(); conn.on('ready', function() { conn.sftp(function(err, sftp) { if (err) throw err; sftp.readdir('/tmp', function(err, list) { if (err) throw err; console.dir(list); conn.end(); }); }); }).connect({ host: '192.168.100.100', port: 22, username: 'frylock', // password: 'foobarbaz', privatekey: require('fs').readfilesync('/here/is/my/key') });
Comments
Post a Comment