Bird
0
0

You want to copy all files from your local folder photos/ to an S3 bucket my-photo-bucket preserving the folder structure. Which command should you use?

hard📝 Application Q8 of 15
AWS - CLI
You want to copy all files from your local folder photos/ to an S3 bucket my-photo-bucket preserving the folder structure. Which command should you use?
Aaws s3 cp photos/ s3://my-photo-bucket/
Baws s3 sync photos/ s3://my-photo-bucket/
Caws s3 mv photos/ s3://my-photo-bucket/ --recursive
Daws s3 ls photos/ s3://my-photo-bucket/
Step-by-Step Solution
Solution:
  1. Step 1: Understand commands for copying multiple files with folder structure

    'aws s3 sync' copies files and preserves folder structure efficiently.
  2. Step 2: Compare with other commands

    'cp' (A) without --recursive does not copy subdirectories. 'mv' (C) moves files (deletes source). 'ls' (D) lists files only.
  3. Final Answer:

    aws s3 sync photos/ s3://my-photo-bucket/ -> Option B
  4. Quick Check:

    Sync copies folders preserving structure [OK]
Quick Trick: Use 'sync' to copy folders preserving structure [OK]
Common Mistakes:
  • Using 'cp' without sync for folders
  • Using 'mv' which deletes source files
  • Using 'ls' which only lists files

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes