# Files and Folders

Files and Folders: Paths and Folders with pathlib, Copying, Moving and Renaming Files Safely.

Updated: November 19, 2026

1. [Paths and Folders with pathlib](https://www.ask-codey.com/lessons/python-automation-paths-with-pathlib) (Apprentice): A Path from Python's pathlib module holds a file's or folder's address in parts, so a script can join paths with /, read a file's name and extension, list and find the files in a folder, and make folders, the same way on Windows and on a Mac.
2. [Copying, Moving and Renaming Files Safely](https://www.ask-codey.com/lessons/python-automation-copy-move-rename) (Journeyman): shutil.copy2 copies a file, shutil.move and Path.rename move and rename one, and three habits keep a file-moving script safe, a backup copy, a check that the destination is free, and a dry run that shows the plan before anything moves.

Source: https://www.ask-codey.com/courses/python-in-depth/topics/python-automation-files
