davglass / cpr

Nodejs cp -R
Other
79 stars 80 forks source link

Does not behave like cp -R when copying a single file #28

Closed ldanet closed 8 years ago

ldanet commented 8 years ago

Hi,

I had assumed that this module would behave like the command it takes its name from, but it appears it does not do so when copying single files.

Say you have this file structure:

foo/
 `-- bar.jpg
baz/

and you want to copy foo/bar.jpg to baz/qux.jpg.

When you execute cp -R foo/bar.jpg baz/qux.jpg in command line, it creates a renamed copy to the target path. You get:

foo/
 `-- bar.jpg
baz/
 `-- qux.jpg

When using this project, on the other hand, you get:

foo/
 `-- bar.jpg
baz/
 `-- qux.jpg/
      `-- bar.jpg

I was relying on this behavior to have a generic purpose file copy module.

davglass commented 8 years ago

Yeah, this module copies full directories and not just single files. I'll look into this when I get a chance.