Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory not empty when calling rmdir recursively #159

Open
mrmnmly opened this issue Sep 10, 2016 · 3 comments
Open

Directory not empty when calling rmdir recursively #159

mrmnmly opened this issue Sep 10, 2016 · 3 comments

Comments

@mrmnmly
Copy link

mrmnmly commented Sep 10, 2016

I'm trying to remove folder with its contents using rmdir method with recursive parameter that is set to true.

Documentation says:

If recursive, this call will delete the contents of the directory if it is not empty.

But I'm getting an error:

throw new Error(err)
             ^
Error: Error: /path_on_ftp: Directory not empty

Anyone tried similar operation? Please help.

@Eschon
Copy link

Eschon commented Sep 23, 2016

I also have this problem.

In my case it works on directories that only contain files, but on directories that contain other directories it fails.

Here's the error that I get, I'm not sure how usefull it is since I use your library through promise-ftp. I'll try to reproduce it with your library alone on monday.

{ Error: /htdocs/images/icons: Das Verzeichnis ist nicht leer
    at makeError (/Users/egon/src/iski.world/node_modules/ftp/lib/connection.js:1067:13)
    at Parser.<anonymous> (/Users/egon/src/iski.world/node_modules/ftp/lib/connection.js:113:25)
    at emitTwo (events.js:106:13)
    at Parser.emit (events.js:191:7)
    at Parser._write (/Users/egon/src/iski.world/node_modules/ftp/lib/parser.js:59:10)
    at doWrite (_stream_writable.js:307:12)
    at writeOrBuffer (_stream_writable.js:293:5)
    at Parser.Writable.write (_stream_writable.js:220:11)
    at Socket.ondata (/Users/egon/src/iski.world/node_modules/ftp/lib/connection.js:273:20)
    at emitOne (events.js:96:13) code: 550 }

@Eschon
Copy link

Eschon commented Sep 26, 2016

Ok I just tested it with this library and it seems to work now. So in my case the issue is probably with promise-ftp

@lfcgomes
Copy link

I cannot delete a folder that is not empty :(

this is my code :

c.on('ready', function() {
switch(itemType){
    case 'file':
        c.delete(itemID, function(err) {
            c.end();
            callback(err);
         });
         break;
    case 'folder':
        c.rmdir(itemID, true, function(err) {
            c.end();
            callback(err);
        });
        break;
    default:
        callback(true);
        }
    });

And I'm always getting the same error:

error:  { [Error: Can't remove directory: Directory not empty]
  cause: { [Error: Can't remove directory: Directory not empty] code: 550 },
  isOperational: true,
   code: 550 }

Any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants