Track 15 · Lesson 2 of 11
Organising files
List, filter and sort files with pathlib, then move them into folders by type or date with dry runs and collision-safe names.
You will be able to
- List and filter files with Path.iterdir, glob and rglob, in a predictable order
- Read a file's name, stem and suffix to decide where it belongs
- Create folders and move or copy files with pathlib and shutil
- Choose a free name when the destination already has a file with the same name
- Sort files into dated folders using the date in the file name
Included with a Formula Quest membership
It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.
View Formula Quest memberships
Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.