1.

How can we copy an entire directory under another directory?(a) using -R option(b) using -a option(c) using -u option(d) none of the mentionedThe question was posed to me by my school teacher while I was bunking the class.Asked question is from Copying a File: cp Command in section Handling Ordinary Files of Unix

Answer»

The CORRECT CHOICE is (a) using -R option

Easy explanation: -R option is used to copy an entire directory structure into another one recursively. Here recursively means that the command can DESCEND a directory and examine all the files in its subdirectories and then it will copy the entire structure. For example,cp-R prog_onenew_prog. It will create a copy of contents of entire directory prog_one to new_prog if new_prog does not exist. OTHERWISE, if new_prog EXISTS as a directory,then the whole structure of prog_one will be copied under new_prog as a subdirectory.



Discussion

No Comment Found

Related InterviewSolutions