Please enable JavaScript.
Coggle requires JavaScript to display documents.
9.Organizing Files ((The shutil Module 198, Copying Files and Folders .…
9.Organizing Files
The shutil Module 198
Copying Files and Folders . 198
Moving and Renaming Files and Folders . 199
Permanently Deleting Files and Folders . 200
Safe Deletes with the send2trash Module 201
Walking a Directory Tree . 202
Project: Renaming Files with American-Style Dates to
European-Style Dates 206
Step 1: Create a Regex for American-Style Dates . 206
Step 2: Identify the Date Parts from the Filenames 207
Step 3: Form the New Filename and Rename the Files 209
Ideas for Similar Programs 209
Practice Projects 213
Selective Copy . 213
Deleting Unneeded Files . 213
Filling in the Gaps 214
Compressing Files with the zipfile Module 203
Reading ZIP Files . 204
Extracting from ZIP Files 205
Creating and Adding to ZIP Files . 205
Project: Backing Up a Folder into a ZIP File 209
Step 1: Figure Out the ZIP File’s Name . 210
Step 2: Create the New ZIP File . 211
Step 3: Walk the Directory Tree and Add to the ZIP File . 211
Ideas for Similar Programs 212
Summary . 212
Practice Questions . 213