How to copy a directory?


I don't know how to copy a directory.

In exercise 5 cp Ⅰ, it is said that I can use the cp command to copy files or directory, but i cannot see any advice on copying a directory. So i try to copy a directory in my own computer.

There is a directory called dir_0 in my root directory and i wanted to make a copy of it. so i typed this command cp dir_0 dir_1 in my terminal. As a result, i encountered an information saying cp: omitting directory 'dir_0', as shown in the following snapshot. What's wrong? Any suggestion? Thank you :slight_smile:


you will need -R:

cp -R dir_0 dir_1

from the man pages:
-R, -r, --recursive
copy directories recursively


thank you so much :relaxed:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.