使用nodejs将文件从一个目录移动到FTP服务器上的另一个目录的模块
我已经尝试了所有模块,如node-ftp、ftp-client、ftp-srv 我找到了 basic-ftp,但它允许我们下载文件,然后将文件上传到目录,但我想将所有文件从一个目录移动到另一个目录,而不是下载然后移动它。 我已成功使用 ftp 列出该文件,阅读后我想将其移动到新目录
return new Promise((resolve, reject) => {
client.list(path, function (err, list) {
let data = [];
if (err) {
reject(error);
}
data = (list && list.data) || [];
return resolve(list);
});
});
I have tried all the modules like node-ftp, ftp-client, ftp-srv
i found basic-ftp but it allow us to download the file and then upload the file to a directory but i want to move all the files from one directory to another instead of downloading and then moving it.
I have successfully list the file using ftp and after reading i want to move it to a new directory
return new Promise((resolve, reject) => {
client.list(path, function (err, list) {
let data = [];
if (err) {
reject(error);
}
data = (list && list.data) || [];
return resolve(list);
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 client.rename(oldFilePath,newFilePath, function (err, list) { ................................................. ..... } 其中
oldpath
将是您要复制文件的路径,例如 -/inside/old/file.csv
到要粘贴/inside/new/file.csv
的位置you can use the
client.rename(oldFilePath,newFilePath, function (err, list) { ................. ................ }
where theoldpath
will be the path from where you want to copy the file, for example -/inside/old/file.csv
to the place you want to paste/inside/new/file.csv