Tutorials by topic

Scripts and file automation

Use small Python scripts to handle repetitive file tasks.

Articles on this topic 9

Step by step, with examples

Scripts and file automation01

Create a CSV list of files in a folder

Scan subfolders and record file paths, extensions, sizes, and modification times in a table. Start with 4 small example files while keeping the originals and existing results intact.

PythonFile organizationCSV
Scripts and file automation02

Merge CSV files and keep the source filenames

Merge CSV files with the same column structure in order and add a source_file column. Use small datasets to check item names containing commas, missing columns, and existing output.

PythonMerging CSV filesSource tracking
Scripts and file automation19

Split a large CSV into smaller files without losing the header

Split a CSV by data-record count, repeat its header in every output file, and leave the original unchanged. Use a seven-record synthetic example to check the boundaries and verify that all records survive in their original order.

PythonCSVAutomation
Scripts and file automation22

Make a dated ZIP backup and verify what was archived

Create a dated ZIP archive from a folder without changing the originals, then verify that every source file appears in the archive with matching content. A small synthetic folder makes the expected paths, sizes, and totals easy to check by hand.

PythonZIPBackup
Read → Run → Check

All examples are for practice. Automotive data is synthetic and used for illustration.