I'm knida new to Python and I made a program that works the way I want by renaming files in bulk, however it will only work in the current folder and will not go into sub directories.
i already have

import os
from os import rename, listdir

is there any other imports i need or will this suffice?

Recommended Answers

All 2 Replies

The main task of your program is to generate a sequence of pairs (src, dst) where src and dst are a path to an existing file or directory and the path to the not yet existing destination.

Once the list is correct, you can call shutil.move() or os.rename() on each pair (read the doc to understand the difference)

Concentrate on generating the correct list of pairs. You may need to use os.walk(), os.listdir() and os.path.join() for example.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.