How to Copy Folder with Files to Another Folder in Linux?

If you know the basics of Linux command line then copying a file would be an easy task for you, all you need to do is just use the cp command with a file name and location.

In a Linux or a Unix environment, such action is called “Recursive”.

How to Copy a Directory in Linux?

In the Linux terms, a folder is called as a directory. So don’t get confused here!

Method #1

The option we’re looking for is -R.

cp -R path_to_source/ path_to_destination/
  • The -R means copy directories recursively.
  • If the destination doesn’t exist, it will be created.

Method #2

If you already in the directory you want to copy the use following command.

cp * path_to_destination/
  • The “*” symbol means everything inside the directory.

This is how we can copy the directory in Linux.

Published by AtulHost

Creator of AtulHost. An ardent Linux user. Comes from a business management background. Loves to do research on modern business insights and technological solutions.

Leave a reply

Required fields are asterisked and email address will not be shared.