I'm looking for a way to bulk rename hundreds of folders based on a CSV file I have. The CSV contains the full paths for the original and the new folder names. For instance, one entry in the CSV might show 'C:dumpfolder 1' as the old folder name and 'C:dumpfolder renamed' as the new name. The structure lists multiple subfolders, all with their complete paths instead of just the folder names. Do I need to adjust the CSV to show only folder names for the subfolders? What would be the best script to use for this bulk renaming task?
3 Answers
You might want to check out PowerRename, which is included in PowerToys. It's said to be great for this kind of bulk renaming. Just keep in mind that it's more of a regex-based tool, so you might have to figure out the regex yourself if your paths are complex.
If you're comfortable with Python, here's a quick script you can use:
```python
import csv
import os
with open(r'c:pathtocsv.csv', newline='') as f:
reader = csv.reader(f, delimiter=',', quotechar='"')
for src, dest in reader:
os.rename(src, dest)
```
This will read your CSV and rename the folders as you need!
You can actually use a simple Windows batch file for this! Just generate the commands needed with an Excel formula based on your CSV. Remember to rename the subfolders first before the parent folders to keep everything organized!

Yeah, it's powerful for sure! Just remember it doesn’t have a direct feature for processing a CSV; you’ll still do some setup to make it work how you want.