Cannot get file list from ftp using ls()
See original GitHub issueI have FTP server which has a folder with a bunch of images in it. I do not know the image names. I want to access all the image files from that FTP folder and read them as base64 format one by one, so I can upload them to some other destination. I am trying to get the list of files in the ftp using the ls() method but run into the error below.
var ftps = new FTPS({
host: 'ftp://mydomain.com/', // required
username: 'username', // required
password: 'password', // required
protocol: 'ftp', // optional, values : 'ftp', 'sftp', 'ftps',... default is 'ftp'
// protocol is added on beginning of host, ex : sftp://domain.com in this case
port: 22, // optional
// port is added to the end of the host, ex: sftp://domain.com:22 in this case
escape: true, // optional, used for escaping shell characters (space, $, etc.), default: true
retries: 2, // Optional, defaults to 1 (1 = no retries, 0 = unlimited retries)
timeout: 10,
requiresPassword: true, // Optional, defaults to true
autoConfirm: true, // Optional, is used to auto confirm ssl questions on sftp or fish protocols, defaults to false
cwd: '' // Optional, defaults to the directory from where the script is executed
});
ftps.ls().exec(function(err, res){
if(err || res.error){
console.log('-------- error');
return console.log('Error getting file list:', (err || res.error));
}
console.log('------- response: ' + res);
});
I get the following error:
Error getting file list: { [Error: spawn ENOENT] code: ‘ENOENT’, errno: ‘ENOENT’, syscall: ‘spawn’ }
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
"FTP cannot retrieve directory listing" error - Bobcares
This error “FTP cannot retrieve directory listing” means that the user could not access the files from FTP server. Users encounter an error ......
Read more >Filezilla FTP Server Fails to Retrieve Directory Listing
After setting it up, I tested connecting to it using the IP 127.0. 0.1 , and it worked successfully. However, to connect to...
Read more >FTP Issue - Directory Files Do Not Appear - Microsoft Q&A
I'm trying to access the F:\inetpub\wwwroot_pub folder via FTP on a VM with Windows Server ... Error: Failed to retrieve directory listing
Read more >Connection to FileZilla FTP server works, but directory listing ...
You can connect, but you cannot list directories or transfer files. For details, see my article on Network configuration for passive FTP mode....
Read more >How to resolve FTP Error “Failed to retrieve directory listing ...
Using my administrator account, I FTP connected to my IIS 7.5 FTP Site with FileZilla. I was able to successfully upload a file,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh ok, I will diagnose the error and see if anything is missing from my side. Thanks for the help, I really appreciate it.
Hello @neeraj87 , did you manage to solve this?