Tagged articles
shutil
23 articles · Page 1 of 1
The article presents five practical Python automation scenarios for operations engineers—remote command execution, log parsing, system monitoring with alerts, batch software deployment, and backup/recovery—each illustrated with concrete code examples and library recommendations.
FabricOperationsParamiko
0 likes · 10 min read

After a senior engineer pointed out that a custom task scheduler could be replaced by Python’s built‑in graphlib, the author explored the standard library and discovered ten modules—dis, singledispatch, ast, atexit, sys.settrace, tomllib, graphlib, heapq, secrets, and shutil—that simplify debugging, code organization, security, and cross‑platform file handling.
HeapqPythondis
0 likes · 16 min read

This article explains how to monitor the /Volumes directory on macOS to detect USB insertion, then uses Python's os, shutil, and re modules to recursively walk the USB file system, filter files by type, size, and modification time, and automatically copy selected files to a local folder.
PythonUSBfile copy
0 likes · 5 min read

This article introduces Python’s shutil module and demonstrates how to copy, move, rename, archive, and delete files and directories with concise code examples while highlighting important safety considerations.
COPYarchivefile-management
0 likes · 3 min read

Learn nine distinct Python approaches for copying files—including shutil functions, os commands, threading, and subprocess methods—while understanding their performance implications, error handling, platform compatibility, and when to choose each technique for optimal I/O efficiency.
File I/Ocopyfileshutil
0 likes · 12 min read

This article provides a comprehensive guide to Python's path manipulation tools, covering the os.path module functions, the object‑oriented pathlib API, file‑matching with glob, and advanced file operations using shutil, complete with code examples and usage recommendations.
Pythonfile-systemglob
0 likes · 17 min read

This guide explains how to open and close files, perform various read and write operations, and manage files and directories in Python using built‑in functions and the os, os.path, and shutil modules, with clear code examples for each task.
File I/OOS modulePython
0 likes · 7 min read

This article introduces Python's built‑in shutil module, explains its key functions for copying, moving, deleting, archiving, and retrieving file information, and provides comprehensive code examples demonstrating how to prepare test files and perform common file‑system tasks such as copying files, moving directories, and creating archives.
COPYMovePython
0 likes · 7 min read

This article introduces Python's built-in os, os.path, and shutil modules, demonstrating how to create and delete directories, manipulate file paths, list directory contents, and perform advanced file operations such as copying, moving, and compressing files with clear code examples.
PythonTutorialfile operations
0 likes · 6 min read

This tutorial explores nine different Python approaches—including shutil, os, threading, and subprocess—to copy files, explaining their behavior, performance implications, error handling, and platform considerations so you can choose the most suitable method for your application.
file copyosshutil
0 likes · 12 min read

This guide demonstrates Python techniques for reading, writing, and manipulating various file types—including text, binary, CSV, and JSON—while also covering file existence checks, renaming, deletion, and directory handling using os and shutil modules.
File I/OOS modulePython
0 likes · 5 min read

This article introduces ten Python libraries—including os, pathlib, shutil, glob, zipfile, tarfile, csv, json, configparser, and logging—that simplify file handling tasks such as checking existence, reading, writing, copying, compressing, and logging, and provides clear code examples for each.
CSVLibrariesfile-operations
0 likes · 6 min read

This article walks through a Python community question about automating office tasks, presents original code for copying Excel files, offers an improved script that recursively moves .xlsx and .xls files, and explains how to adapt the solution for broader file‑automation scenarios.
ExcelPythonfile-automation
0 likes · 7 min read

This tutorial explains how to automate selective folder copying in Python using os.walk and shutil, presenting a two‑step approach that first extracts directories starting with “数据” and then those containing “DD”, complete with full code examples and execution tips.
file automationos.walkshutil
0 likes · 5 min read

This article demonstrates how to use Python's shutil and os modules to automatically traverse directories and copy all files containing a given keyword from a folder and its subfolders, saving time compared to manual copying.
Pythonbatch copyos.walk
0 likes · 4 min read

This tutorial shows how to write a lightweight Python program that runs in the background, detects when a USB drive is mounted, and automatically copies selected files—filtered by type, size, or modification date—to a local folder, illustrating core file‑handling techniques.
PythonUSBfile copy
0 likes · 6 min read

This article presents the ten most frequently used Python file‑handling functions, explaining how to create, open, read, write, copy, move, rename, and delete files with code examples and tips on proper resource management.
file operationsopenos
0 likes · 7 min read

This tutorial explains how to create a Python program that runs in the background, monitors the /Volumes directory for newly mounted USB drives, and automatically copies only selected files based on size, type, or modification date to a local folder.
automationfile handlingos
0 likes · 5 min read

This article walks through four practical Python approaches—using the OS module, pathlib, shutil, and send2trash—to permanently or safely remove directories on Windows, explaining each method's behavior, required settings, and code examples for reliable folder deletion.
OS modulepathlibsend2trash
0 likes · 6 min read

This article introduces the commonly used Python file handling modules—os, shutil, and zipfile—explaining their key functions, demonstrating path operations, file copying, moving, and compression/decompression with practical code examples to help readers efficiently manage files and directories.
OS moduleTutorialZipfile
0 likes · 4 min read

This article introduces Python’s shutil module, explains its purpose as a shell utility supplement to os, and provides detailed examples of its key functions—including copyfileobj, copy, copy2, copytree, rmtree, move, and make_archive—complete with code snippets and usage tips.
COPYMovearchive
0 likes · 7 min read

This tutorial shows how to use Python's os, shutil, and zipfile modules to batch‑compress thousands of folders, delete the original files, and produce zip archives automatically, turning a labor‑intensive task into a one‑minute automated process.
Zipfilebatch-processingfile compression
0 likes · 6 min read

This guide outlines essential Python os and shutil functions for file and directory manipulation, covering path queries, creation, deletion, permission changes, environment variables, and common file opening modes, providing concise examples for each operation.
FilesystemOS modulePython
0 likes · 3 min read
