4. You run cp -r myfolder backup/ but get an error: cp: omitting directory 'myfolder'. What is the likely cause?
medium
A. You used -r but the command was typed incorrectly
B. The destination folder 'backup/' does not exist
C. You forgot the -r option to copy directories
D. You ran cp without -r option on a directory
Solution
Step 1: Understand the error message
The error 'omitting directory' happens when cp tries to copy a directory without the recursive -r option.
Step 2: Check the command given
The question says you ran cp -r myfolder backup/ but error suggests -r was missing or command was different.
Final Answer:
You forgot the -r option to copy directories -> Option C
Quick Check:
Missing -r causes 'omitting directory' error [OK]
Hint: Always use -r to copy directories [OK]
Common Mistakes:
Assuming destination folder missing causes this error
Typing -r incorrectly but not noticing
Ignoring error message meaning
5. You want to copy all files and folders from project/ to backup/, but only if the files in backup/ are older than those in project/. Which command achieves this?
hard
A. cp -ru project/ backup/
B. cp -r project/ backup/
C. cp -rf project/ backup/
D. cp -ri project/ backup/
Solution
Step 1: Understand the options
-r copies directories recursively, -u copies only when source is newer than destination, -f forces overwrite, -i prompts before overwrite.
Step 2: Choose the correct combination
To copy directories and update only newer files, use -ru. This copies recursively and updates only if source is newer.
Final Answer:
cp -ru project/ backup/ -> Option A
Quick Check:
Use -ru to copy recursively and update only newer files [OK]
Hint: Use -ru to copy folders and update only newer files [OK]
Common Mistakes:
Using -r alone copies all files regardless of age
Using -f overwrites without checking timestamps
Using -i prompts but doesn't check file age
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.