Renaming multiple files using loop?

Hi everyone,

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

I have this code:

(Get-Content Individual_.xml.001.part.xml) -replace ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"', '' | 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?

TIm,
Welcome to the forum. :wave:t4:

With

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