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

clobber for directories #201

Closed
piranna opened this issue Dec 10, 2015 · 4 comments
Closed

clobber for directories #201

piranna opened this issue Dec 10, 2015 · 4 comments

Comments

@piranna
Copy link

piranna commented Dec 10, 2015

Reading the code I've found copy (and move) merge the content of the directories if the destination (and any of its subfolders) exists. That's just the feature I was looking for :-D But I've noticed that there's no option to delete destination (sub-)folders to only have the files we are copying and none of the old ones, the same way the clobber option overwrite destination files when enabled...

@jprichardson
Copy link
Owner

This feels like maybe it'd be doing too much though. Copying shouldn't read the destination unless there is a conflict with what is being copied, right? Maybe a better solution would be that if a destination directory exists, an event is emitted allow the user to read the directory and then take action. IDK.

@piranna
Copy link
Author

piranna commented Dec 11, 2015

Copying shouldn't read the destination unless there is a conflict with what is being copied, right? Maybe a better solution would be that if a destination directory exists, an event is emitted allow the user to read the directory and then take action

Why no both? :-) If a conflict on destination arises, call a onConflict callback so user can return what to do with it, like overwrite, ignore, ignoreAndDelete (source) or abort (and also the callback could be set to one of these values instead a function so it will be done always that way). There could be also independent callbacks for directories and files to have fine-grain control, so also the clobber option would be deprecated at all :-D

{
  onConflictDir: 'merge',
  onConflictFile: 'overwrite'
}

Nice, eh? :-)

@jprichardson
Copy link
Owner

It's not a bad idea, but my priority is to get to 1.0 first. We can then revisit it then :) Tagged as future.

@piranna
Copy link
Author

piranna commented Dec 17, 2015

I agree :-)

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