Replace filenames (with external file list)

I export file list to .txt file in directory by using:

ls | % Name > files.txt

and i would to change names using list in excel like

Did someone have an idea how to change names using external list? Script?
Replace column A and B to something like this?

Rename-Item -NewName {$ -replace "OLDname1.pdf","NewName1.pdf"}
Rename-Item -NewName {$ -replace "OLDname2.pdf","NewName2.pdf"}
Rename-Item -NewName {$ -replace "OLDname3.pdf","NewName3.pdf"}

and somehow run as a script (don’t know how yet)?

I had more than 20 000 files :sob: to rename :frowning:

Welcome to the forum. :wave:t4:

What you’re asking for is a very common task. It has been asked thousand times before and it has benn answered already thousand times before. So no need to re-invent the wheel again. Use your favorite search enginge to look for examples.

To get you started you should read the help for the following cmdlets completely including the examples to learn how to use them:

It might be just the poorly chosen examples file names but if the difference between you olad filenames and new filenames is OldNew you wouldn’t need an input file. :wink:

BTW: It is considered very bad style to use aliasses in scripts and in forums. Please try to avoid them. It makes your code harder to read. You may read more about here: