How do I copy folder with files to another folder in Unix/Linux? [closed]

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.
  • To copy everything inside the source folder (symlinks, hidden files) without copying the source folder itself use -a flag along with trailing /. in the source (as per @muni764‘s / @Anton Krug‘s comment):
cp -a path_to_source/. path_to_destination/

Leave a Comment