Renaming multiple files using loop?

Hi everyone,

I want to make changes inside and rename 10 files in my folder that look like this:

I have this code:

(Get-Content Individual_.xml.001.part.xml) -replace ' xmlns:xsi=""', '' | Set-Content -encoding ASCII Individual_1.xml

This code replaces the data inside this file: Individual_.xml.001.part.xml
And create a new file with name: Individual_1.xml

How do I use for loop here to apply this change on all 10 files?

Welcome to the forum. :wave:t4:


you list all desired files, pipe it to

and do whatever you need to do inside the script block of Foreach-Object

Please read the help topics for the cmdlets you’re about to use completely including the examples to learn how to use them.

1 Like