i created a new folder with:
$NewPath = New-Item "\\...\newExampleFolder -ItemType directory
and copy an older in the new with:
$ OldPath = "D:\...\old.ExampleFolder"
Copy-Item $OldPath* $NewPath -recurse
Now are in the new folder ini. files from the old folder and in the ini files are some paths how refer on ohter ini files. I want to change the paths in the ini files of the new folder.
Example ini:
[setting1] = 1
[enginge] = 2
[setting2] = \...\old.ExampleFolder\Settings\
I tried;
$inifiles = Get-ChildItem -Path \\...\newExampleFolder\* include *.ini -
recurse
foreach($file in $inifiles)
{
(Get-Content $file.PSPath)
Foreach-Object {$file -replace
[regex]::Escape('D:\...\old.ExampleFolder\'),
('\\...\newExampleFolder\') |
set-content $file.PSPath
}
but it changed only the content of the ini files and not the Path what are inside of the ini file. I dont no what is from can someone help me please?