Bird
0
0

You want to organize your daily work files by date inside folders named by year and month. Which command sequence helps automate this?

hard📝 Application Q8 of 15
Linux CLI - File and Directory Operations
You want to organize your daily work files by date inside folders named by year and month. Which command sequence helps automate this?
Acp *.txt $(date +%Y/%m)/
Bmkdir $(date +%d) && mv *.txt $(date +%d)/
Cmkdir -p $(date +%Y/%m) && mv *.txt $(date +%Y/%m)/
Dmv *.txt $(date +%Y-%m-%d)/
Step-by-Step Solution
Solution:
  1. Step 1: Understand date format for year/month folders

    $(date +%Y/%m) creates folder path like 2024/06.
  2. Step 2: Use mkdir -p to create nested folders and move files

    mkdir -p creates folders if missing; mv moves text files into them.
  3. Final Answer:

    mkdir -p $(date +%Y/%m) && mv *.txt $(date +%Y/%m)/ -> Option C
  4. Quick Check:

    Automate folder creation by year/month = D [OK]
Quick Trick: Use mkdir -p with date and mv to organize files [OK]
Common Mistakes:
MISTAKES
  • Using day instead of year/month
  • Moving files before creating folders
  • Copying instead of moving files

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes