Query on "cp" command

1

I have a directory say ~/MyWorks which contains the following files in it: a.c, b.c and c.c

I want to copy the MyWorks directory to ~/MyAssignments such that only the directory MyWorks is copied and not the files in it. How should I best go about this?

LinuxPenseur

Posted 2010-12-02T04:19:08.890

Reputation: 191

What do you want to happen with the files that currently exist in MyWorks? – SiegeX – 2010-12-02T04:23:47.637

1BTW, you can use backticks `like this` to put bits of code inline in your post, like this, so that you don't have line breaks all over the place. – None – 2010-12-02T04:24:34.907

@SiegeX. First i want to create MyWorks directory and after that only i need to copy the files in it – LinuxPenseur – 2010-12-02T05:10:18.503

Answers

10

mkdir ~/MyAssignments/MyWorks

drewrobb

Posted 2010-12-02T04:19:08.890

Reputation: 621

2A++++++++ Would Read Again – erjiang – 2010-12-02T04:22:30.650

3To clarify: you're not really "copying" the directory; you just want to end up with a directory with the same name. Since you're going to have to type the name of the directory anyway, just use the "make a directory with this name" command, which is spelled mkdir. – None – 2010-12-02T04:26:26.447