Tidy Up a Messy Downloads Directory
The downloads directory at /home/laborant/downloads has become the usual mess:
/home/laborant/downloads
├── report-2026.pdf
├── minutes.pdf
├── team.jpg
├── beach.jpg
├── final-FINAL-v2(1).txt
└── tmp-junk
├── cache-01.tmp
└── cache-02.tmp
Sort it out.
Task 1: Build somewhere to put things
Create two directories:
/home/laborant/sorted/documents/home/laborant/sorted/images
Note that sorted does not exist yet either.
Hint 1
One option to mkdir will create a whole chain of directories in a single command.
Task 2: File things away
Move the two PDFs into sorted/documents, and the two JPGs into sorted/images.
They should no longer be in downloads afterwards.
Task 3: Fix a bad filename
The file final-FINAL-v2(1).txt needs a sensible name. Move it into
sorted/documents and rename it to notes.txt at the same time.
Its contents must be preserved.
Hint 2
The brackets in the old filename have meaning to the shell. Wrapping the whole name in single quotes makes the shell treat it as plain text:
'final-FINAL-v2(1).txt'
Task 4: Take out the rubbish
Delete the tmp-junk directory and everything inside it.
Leave the downloads directory itself in place.
Hint 3
rm refuses to delete a directory unless you tell it to work recursively.