How to copy files with different extensions?

QuestionsQuestions8 SkillsProBasic Files OperationsOct, 01 2025
0174

To copy files with different extensions, you can specify each file individually in the cp command. Here's the syntax:

cp file1.ext1 file2.ext2 file3.ext3 destination_directory/

For example, if you want to copy document.pdf, image.png, and notes.txt to a directory named backup, you would use:

cp document.pdf image.png notes.txt backup/

If you want to copy all files with specific extensions (e.g., .txt and .jpg), you can use multiple commands or combine them with wildcards. For example:

cp *.txt backup/
cp *.jpg backup/

This will copy all .txt files and all .jpg files to the backup directory.

0 Comments

no data
Be the first to share your comment!