AutomateTheBoringStuff.Ch09 package¶
Subpackages¶
Submodules¶
AutomateTheBoringStuff.Ch09.P1_delete module¶
Delete
This program permanently deletes files ending with a .txt extension in the current directory
using os.
Note
Demonstrates testing/debugging using comments.
AutomateTheBoringStuff.Ch09.P2_tree module¶
Tree
This program walks a directory tree and prints the contents.
Note
Walks the ./delicious directory.
AutomateTheBoringStuff.Ch09.P3_zipfile module¶
ZIP file
This program manipulates a compressed file using zipfile and os.
Note
Works with provided ZIP file example.zip.
AutomateTheBoringStuff.Ch09.P4_renameDates module¶
Rename dates
Renames filenames with American MM-DD-YYYY date format to European DD-MM-YYYY date format.
Uses os to get the list of files, re to find the files with the American
date format, and shutil to rename them.
Note
- Assumes only files with American date format are in the folder. May also match files with European date format.
- Using debug mode: Prints out files to be renamed. Uncomment to rename files.
AutomateTheBoringStuff.Ch09.P5_backupToZip module¶
P5_backupToZip.py
Implements a function that copies an entire folder and its contents into a ZIP file whose filename increments.
Note
Uses provided ./delicious folder as a demonstration.
- 
AutomateTheBoringStuff.Ch09.P5_backupToZip.backupToZip(folder: str) → None[source]¶
- Backup to ZIP - Copies given folder and its contents into a ZIP file with the name - folder_#.zip, where- folderis the given folder and- #is an incremented integer starting from- 1.- Parameters: - folder – String with path to folder that is to be archived. Function automatically converts to absolute path, so relative paths are okay. - Returns: - None. Prints status updates and creates ZIP file in same folder as given folder.