Practice: Tidy Downloads
Wildcards for real.
Let's tidy the messy downloads folder for real, using folders and wildcards. Here's the task. Make three folders, photos, invoices, and notes. Move each kind of file into its folder. Pause and try it first.

- Tidy the downloads folder
- photos, invoices, notes
- Pause and try first
Sorting the files
First, MK dir makes the three folders in one go. Then three MV commands, each with a wildcard. Every JPG goes into photos. Every invoice goes into invoices. We use invoice dash star here, so the pattern can't match the new invoices folder itself. And every notes file goes into notes. Look how much is left. Just two files.
mkdir photos invoices notes mv *.jpg photos mv invoice-* invoices mv notes*.txt notes ls invoices notes photos setup.deb song.mp3
Checking the result
Tree shows the result. Each folder holds exactly the files we expected. Eight files sorted, with just four short commands. That's the power of wildcards.
tree . ├── invoices │ ├── invoice-feb.pdf │ └── invoice-jan.pdf ├── notes │ ├── notes1.txt │ ├── notes10.txt │ └── notes2.txt ├── photos │ ├── photo1.jpg │ ├── photo2.jpg │ └── photo3.jpg ├── setup.deb └── song.mp3 4 directories, 10 files
Summary
With MK dir, MV, and wildcards, you tidied a whole folder in seconds. Next, reading the contents of files.
Key takeaways- mkdir the folders
- mv with wildcards
- tree to check