Skip to main content
100%

Add a prefix to all the filenames in a directory

✓ Published0🌍 Public
Aamundo
Last edited Oct 20, 2011
Created on Oct 20, 2011

This example demonstrates a simple file-renaming script that adds a prefix to every text file in the current directory. The code uses Python’s `glob` module to collect all filenames ending in `.txt` and then applies `os.rename` to prepend the string `brad_` to each file. The process is iterative, renaming files one by one in place, with no rendering or data visualization involved.

AI-generated description

Similar vizzes