What is the correct syntax for copying multiple files with a

what-is-the-correct-syntax-for-copying-multiple-files-with-a

What is the correct syntax for copying multiple files with a filename starting as ‘file’ into another file named as  ‘directory_one’?

A. cp -i file  directory_one

B. cp -R file  directory/directory_one

C. cp file*  directory_one

D. none of the mentioned

I have been asked this question in an internship interview.

Origin of the question is Copying a File: cp Command topic in chapter Handling Ordinary Files of Unix

The correct answer is C. cp file*  directory_one

Easy explanation: For copying multiple files with a common starting name such as (file, file001, file.txt, fileone.jpg, file-archive.zip) we use (“*”). An asterisk (“*”) is a wildcard – a special character which expands to match other characters.  For example,  cp file*  directory_one will copy all the files whose name will be starting with ‘file’  into  ‘directory_one’ file.