Giter VIP home page Giter VIP logo

Comments (4)

mscdex avatar mscdex commented on June 26, 2024

What does your code look like?

EDIT: Also, when entering PASV mode, is the IP given by the server in its PASV response correct?

from node-ftp.

myoung69 avatar myoung69 commented on June 26, 2024

The IP in PASV line is correct.

The code i am using is below.
Please forgive the bad coding i am still learning how to do this.

And as always thank you for whatever help you can give me.

var Client = require('ftp'),
    connects = 0,
    filelist = [];


var srcparams = { // windows FTP Server
    host: "ftptest1.com",
    port: 21,
    user: "ftp",
    password: "password"
};

var destparams = {
    host: "ftptest2.com",
    port: 21,
    user: "ftp",
    password: "password"
};

var src = new Client();

var dest = new Client();

src.on('ready', function() {
    console.log('source ready');
    connects++;
    list();
});

dest.on('ready', function() {
    console.log('destination ready');
    connects++;
    list();
});

src.connect(srcparams);
dest.connect(srcparams);

function DirWalk(dir, prefix, callback) {
    var directory;
    if (prefix !== undefined || prefix !== '') {
        directory = prefix + '/' + dir;
    } else {
        directory = dir;
    }
    src.list(directory, function(err, dirlist) {
        if (err) {
            console.log(err);
        }
        callback(null, directory, dirlist);
    });
}

function toDirList(files, prefix) {
    if (prefix === undefined) {
        prefix = '';
    }
    for (var b in files) {
        files[b].path = prefix;
        filelist.push(files[b]);
        if (files[b].type === 'd') { // is a directory
            files[b].path = prefix;
            DirWalk(files[b].name, prefix, function(err, prefix, dirlist) {
                if (dirlist.length > 0) {
                    toDirList(dirlist, prefix);
                }
            });
        } else if (files[b].type === '-') {

        }
    //console.log(filelist);
    }
}

function list() {
    if (connects === 2) {
        src.list(function(err, list) {
            toDirList(list);
        });
    }
}

from node-ftp.

myoung69 avatar myoung69 commented on June 26, 2024

Yes the IP is correct in this line.
[connection] < '227 Entering Passive Mode (192,96,210,12,8,127).\r\n'

from node-ftp.

mscdex avatar mscdex commented on June 26, 2024

What if you limit calling DirWalk so that instead of the for-loop, it's only called again once the callback is called?

from node-ftp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.