Back to Blog
Tutorial2025-01-269 min read
How to Bulk Rename Files from a List: CSV, TXT & Excel Methods
How to Bulk Rename Files from a List: CSV, TXT & Excel Methods
When you need precise control over new filenames, use a list. Here's how to rename files from CSV, TXT, and Excel files.
Preparing Your Rename List
CSV Format
old_name,new_name
IMG_001.jpg,beach-sunset-2024.jpg
IMG_002.jpg,beach-family-portrait.jpg
IMG_003.jpg,hotel-pool-morning.jpgTXT Format (tab-separated)
IMG_001.jpg beach-sunset-2024.jpg
IMG_002.jpg beach-family-portrait.jpg
IMG_003.jpg hotel-pool-morning.jpgMethod 1: PowerShell with CSV
Import-Csv "rename-list.csv" | ForEach-Object {
Rename-Item $_.old_name $_.new_name
}With error handling
Import-Csv "rename-list.csv" | ForEach-Object {
if (Test-Path $_.old_name) {
Rename-Item $_.old_name $_.new_name
Write-Host "Renamed: $($_.old_name) -> $($_.new_name)"
} else {
Write-Warning "File not found: $($_.old_name)"
}
}Method 2: Bash with CSV (Mac/Linux)
while IFS=, read -r old_name new_name; do
mv "$old_name" "$new_name"
done < rename-list.csvMethod 3: Python Script
import csv
import os
with open('rename-list.csv', 'r') as file:
reader = csv.DictReader(file)
for row in reader:
old = row['old_name']
new = row['new_name']
if os.path.exists(old):
os.rename(old, new)
print(f"Renamed: {old} -> {new}")Method 4: Excel VBA Macro
Sub RenameFiles()
Dim ws As Worksheet
Set ws = ActiveSheet
For i = 2 To ws.Cells(Rows.Count, 1).End(xlUp).Row
oldName = ws.Cells(i, 1).Value
newName = ws.Cells(i, 2).Value
Name oldName As newName
Next i
End SubCreating Your List Efficiently
From File Explorer 1. Open folder in Command Prompt 2. Run: dir /b > filelist.txt 3. Open in Excel 4. Add new names in column B
Using Excel Formulas Generate new names with formulas:
=CONCATENATE("2024-01-",A1)Tips for Success
- Back up first - Always keep copies
- Test on samples - Try 5 files before 500
- Check for duplicates - Ensure unique new names
- Match extensions - Keep file extensions consistent
When Lists Aren't Practical
For truly intelligent naming without manual lists, File Renamer AI analyzes file content and generates meaningful names automatically.
Try File Renamer AI - Skip the spreadsheet.