Doug Fir
Doug Fir

Reputation: 21204

Make a copy of a file and give it a different name mac terminal

Mac.

I'm in a directory dogs/scripts/cats.

Within this directory there is a file bla.txt.

I would like to make a copy of bla.txt called bla2.txt and keep it in the same directory.

How do I do that?

cp bla.txt dogs/scripts/cats

'bla.txt' and `dogs/scripts/cats/bla.txt' are the same file

Upvotes: 44

Views: 64947

Answers (1)

Mureinik
Mureinik

Reputation: 311028

cp can get a name of a target file:

cp bla.txt ./bla2.txt

Or even simpler, as Mark noted:

cp bla.txt bla2.txt

Upvotes: 61

Related Questions