Copying Files
Learn how to copy files using the CLI.
We'll cover the following...
The cp
command
To copy a file, we use the cp
command, and specify the source and destination paths.
Let’s try this out by creating a README.md
file in the files/code/elm
directory. We then copy that file to the other code directories:
mkdir -p files/{movies,music,photos,docs/{diagrams,markdown},code/{go,js,elm}}
mkdir -p files/code/elm
echo "# Project README" > files/code/elm/README.md
cat files/code/elm/README.md
We can practice the code in the terminal below.
To copy this file to the files/code/go
directory, we use the cp
command and specify the source path, files/code/elm/README.md
, and then the destination path, files/code/go/README.md
:
$ cp
...