Tools worth exploring
Python: begin a useful script with a test file
Begin Python automation with an inspectable read-only report, adding input and failure boundaries before AI-written code modifies files.

Start with a read-only report
A useful first script can report on files without modifying them. This example lists direct files in a demo folder with byte sizes, keeping scope easy to inspect.
List names and byte sizes
Create the folder and two test files, save report.py in its parent and run it there. csv.writer handles filenames containing commas. Output goes to the terminal rather than silently overwriting a file.
from pathlib import Path
import csv, sys
root = Path("demo")
if not root.is_dir():
raise SystemExit("Create the demo folder first")
writer = csv.writer(sys.stdout)
writer.writerow(["name", "bytes"])
for item in sorted(root.iterdir()):
if item.is_file():
writer.writerow([item.name, item.stat().st_size])A report of direct files only; the folder and its contents are not modified.
Download example text ↓Understand the limits of the sample
The sample does not recurse or suppress permission errors. A changing directory can remove a file before its size is read; production code needs to handle that race. Extend a correct bounded report before adding mutation.
Test awkward names and incomplete access
Use synthetic filenames containing commas, spaces and Arabic, then inspect generated CSV. Manual comma joining fails for comma-bearing names; proper quoting matters. Test empty and missing folders, distinguishing successful empty output from unreadable input. Per-file handling should report exclusions rather than hiding incomplete coverage.
An AI-assisted extension should first expose its proposed actions and reasons without execution. Add rename or deletion only after collision checks and recovery planning. Review symlinks and files changing between path selection and read; the small sample does not handle every case. Its boundaries belong in the documentation rather than behind a claim of complete safety.
Sources & further reading
Sources support concepts and features; proposed trials are educational examples.
Prepared with AI assistance. Educational examples are not product tests; actual measurements identify their method and scope. Editorial approach ↗
Practice: audit a folder with a read-only Python script
The ZIP contains three tiny fictional sample files, including a Unicode filename. A read-only script inventories relative paths and byte sizes without changing or uploading file contents.
Run the exercise
- Extract the ZIP to a dedicated scratch folder and run: python inventory.py sample-files. Keep the default path under your own control.
- Compare the sorted CSV printed by the script with expected-inventory.csv. Notice that byte lengths differ from character counts for Arabic UTF-8 text.
- Try an empty folder and a nonexistent path. Confirm the script handles missing folders clearly and does not overwrite any source file.
Reference outcome: Three sorted entries with byte sizes derived from the supplied files; no file content is sent anywhere.
Limits: The script walks local files and prints metadata only. Symlinks, permissions, race conditions, and very large trees require additional production safeguards.
Download the exercise and reference files (ZIP)
Exercise added October 29, 2026. Fictional teaching cases, not external service test results.