node-fs-extra
node-fs-extra copied to clipboard
--merge option for move
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.
Not sure I understand what you mean by "loop over contents"
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.
Hmm, seems pretty complicated. Basically like rsync
, but moving instead of copying.
Here's an implementation https://github.com/kellyselden/fs-move/blob/master/src/index.js.