P
P
Pavel Pavel2019-04-21 12:49:49
Windows
Pavel Pavel, 2019-04-21 12:49:49

How to bulk rename files from two different folders?

Hello.
Please tell me a solution for mass renaming files.
Folder #1 contains a music database that looks like this:
MKDL10123_Pupko, Ivan_-_Track 1.wav
MKDL10144_Prosto, Kostya_-_Track 2.wav
MKDL10147_Good, Man_-_Track 352.wav
Folder #2 stores program extension files that have the following look:
MKDL10123.wav_dig
MKDL10123.wav_env
MKDL10144.wav_dig
MKDL10144.wav_env
MKDL10147.wav_dig
MKDL10147.wav_env
Task: to make all files from data folder #2 look like this:
MKDL10123_Pupko, Ivan_-_Track
1_wav_Pok3 1.wav_env
MKDL10144_Prosto, Kostya_-_Track 2.wav_dig
MKDL10144_Prosto, Kostya_-_Track 2.wav_env
MKDL10147_Good, Man_-_Track 352.wav_dig
MKDL10147_Good, Man_-_Track 352.wav_env
The music database has more than 5 thousand files, I don’t want to work with handles.
Surely, in Total Commander or Windows tools, you can somehow massively rename files. I will be glad if someone will prompt/help to carry out the task. Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2019-04-21
@pavelzabavin

For such tasks, there is Powershell.
I think this script will help you
$dir1 = "C:\1" #folder where you need to take names for files
$dir2 = "C:\2" #folder where files will be renamed
$folder1 = Get-ChildItem -Path "$dir1" | Select-Object -ExpandProperty Name
$folder2 = Get-ChildItem -Path "$dir2" | Select-Object -ExpandProperty Name
$folder1 = $folder1 -replace ".wav",""
foreach ($fold in $folder2)
{
$tmp = $fold.split(".")[0]
$tmp2 = $folder1 | Where-Object {$_ -like "*$tmp*"}
$tmp3 = $fold.split(".")[-1]
$newname = "$tmp2.$tmp3"
}

@
@nidalee, 2019-04-21
_

I use Advanced Renamer , it might help. There's a lot that can be done there.
Although you have some very strange case, how is the program supposed to guess what to rename the final file to, based on the first digits? I think you need to write the script yourself...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question