question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot get file list from ftp using ls()

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
neeraj87commented, Dec 10, 2016

Oh ok, I will diagnose the error and see if anything is missing from my side. Thanks for the help, I really appreciate it.

0reactions
jarodiumcommented, Apr 25, 2017

Hello @neeraj87 , did you manage to solve this?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found