December 2025
Beginner
368 pages
7h 49m
English
Chapter 4
IN THIS CHAPTER
Talking the talk
Playing it safe with automation scripts
Walking through directory trees
Grouping files according to file type
Batch file naming
Many automation scripts save you time and effort by navigating through folders and files to make changes to files. Python offers many tools and techniques for working with directories (folders) and files. Three modules are key:
os: Provides ways to interact with the operating system (Linux, macOS, Windows) including navigating folders and files, and working with paths and environment variablesshutil: Utilities for copying, moving, renaming, and deleting folders and filespathlib: Provides a newer, object-oriented way to work with folders and files, making it easier to create scripts that work on any operating systemThese modules are part of the standard library, which means they’re built in. When you want to use any of these modules, you don’t need to pip install them. Instead, ...
Read now
Unlock full access