Skip to content

cp and rename directory with -r doesn't match unix behavior #256

@jedwards1211

Description

@jedwards1211

As shown below, if I do cp -r a b with shelljs where a is a directory and b doesn't exist, shelljs creates b/a directories and the copies the contents of a into b/a. Instead, like in a unix shell, it should create b directory and copy the contents of a into b.

> mkdir a
> touch a/file.txt
> node
> require('shelljs/global')
{}
> cp('-r', 'a', 'b');
undefined
> 
(To exit, press ^C again or type .exit)
> 
> ls b/
a
> rm -rvf b
b/a/file.txt
b/a
b/
> cp -rvp a b
a -> b
a/file.txt -> b/file.txt

Metadata

Metadata

Assignees

Labels

fixBug/defect, or a fix for such a problem

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions