davglass / cpr

Nodejs cp -R
Other
79 stars 80 forks source link

Overwrite doesn't seem to work for files under the directories #9

Closed surajreddy closed 10 years ago

surajreddy commented 10 years ago

If I'm copying dirA to parent, then dirA/test.png doesn't seem to overwrite parent/dirA/test.png with the overwrite flag set to true. Is this not supported?

Thanks!

davglass commented 10 years ago

Can you please provide an example so that I can test it.. It does what it's expected to do in my unit tests.

surajreddy commented 10 years ago

Can I take a look at the test? Maybe I'm overlooking something in my code.

I'm trying to do a cp -R -f

Here's my code:

        cpr(source_folder, dest_path, {
            deleteFirst: true,
            overwrite: true
        }, function(err) {
            if (err) {
                return cb(err); //return error
            }
        });

I tried it without the deleteFirst to be safe.

When there are no files present it seems to copy fine, but when there are files there it doesn't seem to overwrite them.

surajreddy commented 10 years ago

I think it's something else with my folder structures. I'll re-open if I still face the issue.

surajreddy commented 10 years ago

Just an update - turns out it was a race condition with another task. The files were getting copied, but then overwritten by a different gulp task.

Thank you for humoring me, and I'm sorry to have wasted your time.