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

--merge option for move #668

Open
kellyselden opened this issue Apr 5, 2019 · 4 comments
Open

--merge option for move #668

kellyselden opened this issue Apr 5, 2019 · 4 comments

Comments

@kellyselden
Copy link

I have the need for the following workflow:

  • if dest doesn't exist, move
  • otherwise, loop over contents
    • repeat

The main difference with the current move is that it deletes the dest before the move, whereas this would merge if conflicted. I figured I would offer to attempt to build it here instead of a new package, if you're interested.

@RyanZim
Copy link
Collaborator

RyanZim commented Apr 5, 2019

Not sure I understand what you mean by "loop over contents"

@kellyselden
Copy link
Author

If it's a folder, readdir and repeat the check for all contents, then recurse until done. The goal is short-circuit at every opportunity to just do a move/rename.

@RyanZim
Copy link
Collaborator

RyanZim commented Apr 5, 2019

Hmm, seems pretty complicated. Basically like rsync, but moving instead of copying.

@kellyselden
Copy link
Author

Here's an implementation https://github.com/kellyselden/fs-move/blob/master/src/index.js.

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

No branches or pull requests

2 participants