How to copy a directory?

QuestionsQuestions8 SkillsProBasic Files OperationsSep, 04 2025
0118

To copy a directory and its contents, you can use the cp command with the -r (recursive) option. The syntax is as follows:

cp -r source_directory destination_directory

For example, to copy a directory named source_dir to a new directory named destination_dir, you would use:

cp -r source_dir destination_dir

This command will copy source_dir and all of its contents (files and subdirectories) into destination_dir. If destination_dir does not exist, it will be created.

0 Comments

no data
Be the first to share your comment!