Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)
I am facing some problem while copying a folder with files in that folder into another folder. The command I am using is cp -r but it doesn't copy files in the folder.

1 Answer

0 votes
by (36.8k points)

This is the option you're looking for is -R.

cp -R path_to_source path_to_destination/

  • If destination doesn't exist, it will be created.
  • -R means copy directories recursively. You can also use -r since it's case-insensitive.
  • Note the nuances with adding the trailing / as per @muni764's

Want to be a Linux expert? Come and join this Linux course

Do check out the video below

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...