Reputation: 185
I need a function in NodeJS (or an existent one, although I did't find one) that copies a folder to a diferent location but only copies the non existing files in the destination:
Folder to Copy:
-- Folder1
---- Folder1_1
------- File1_1_1
---- Folder1_2
------- File1_2_1
Destination Path has:
-- Folder1
---- Folder1_1
------- File1_1_1
So this method should only copy Folder1.2 and it's contents (File1.2.1) since all the other files are present already.
Does anyone have any idea on how to do this or if there is a module that has a method that does this?
Upvotes: 1
Views: 1510
Reputation: 313
simply use ncp and set the property options.clobber
to false, then it wont replace any files already existing.
Upvotes: 2