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

Moving files to parent folder gives error #21

Open
woubuc opened this issue Nov 4, 2015 · 2 comments
Open

Moving files to parent folder gives error #21

woubuc opened this issue Nov 4, 2015 · 2 comments

Comments

@woubuc
Copy link

woubuc commented Nov 4, 2015

I'm trying to move files from a subfolder to process.cwd() but when I try, it gives an ENOTEMPTY error.

{ [Error: ENOTEMPTY, rename '/Users/wouter/Dev/project-templates/project-template/bin/']
  errno: -66,
  code: 'ENOTEMPTY',
  path: '/Users/wouter/Dev/project-templates/project-template/bin/' }

It seems like it's trying to rename the cwd (as I'm testing the cli I'm working on in the bin folder directly). The same thing happens when I use npm link and test it in a newly created test directory.

@andrewrk am I missing a setting or something, or is this just not possible with mv?

@sigmasoldi3r
Copy link

sigmasoldi3r commented Aug 24, 2017

+1 I get another error but is when trying to move a folder one level up (Like moving to ../)

fs.js:310
  binding.stat(pathModule._makeLong(path), req);
          ^

TypeError: path must be a string or Buffer
    at Object.fs.exists (fs.js:310:11)
    at Object.destExists (...)
(...)/node_modules/node-mv/index.js:50:76
    at FSReqWrap.cb [as oncomplete] (fs.js:312:19)

Code

What is tested so far, is taken directly from examples:

  /**
   * Moves the directory tree one level up.
   * @param {string} from
   * @returns {Promise}
   */
  __moveDirs (from) {
    return new Promise((resolve, reject) => {
      mv(from, this.__dest, (err) => {
        if (err) {
          reject(err);
        } else {
          resolve();
        }
      });
    });
  }

Where this.__dest is the parent of from

I'll try another solution in the meantime

@gigouni
Copy link

gigouni commented Sep 26, 2018

FYI,

I was having this problem and solved it using another npm module, copy-dir-cli. Simple but works great!

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