Last active
August 9, 2020 14:34
-
-
Save Jerem1ahJones/c5d767fa351a3dce0d2c0007d6c59f1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put here the source path of your ManifestFiles. | |
$sourcepath = "E:\daz\Program Files\directory\Applications\Data\DAZ 3D\InstallManager\ManifestFiles" | |
# writes all files with the suffix *.dsx in an array | |
$alldsx = Get-Childitem $sourcepath "*.dsx" -Recurse | |
# creates array for location | |
$locations = @() | |
# writes all locations of all xml elements (or dsx in our case) in the array $locations | |
foreach ($dsxobject in $alldsx) | |
{ | |
# gets content of the dsx file | |
[xml]$dsx = Get-Content $dsxobject.FullName | |
# accesses the location information of the data we want to change an attach it to the array | |
$locations += (Select-Xml -Xml $dsx -XPath '//DAZInstallManifest').Node.UserInstallPath.VALUE | |
} | |
# groups and counts all xml files | |
$locations.GetEnumerator() | Group-Object | |
# searches and replaces the data we want to change | |
foreach ($dsxobject in $alldsx) | |
{ | |
# loads the content | |
[xml]$dsx = Get-Content $dsxobject.FullName | |
foreach ($DAZInstallManifest in (Select-Xml -Xml $dsx -Xpath '//DAZInstallManifest')) | |
{ | |
# put here the value you want to change (open up dsx with note pad and copy past the wrong installation path) | |
if ($DAZInstallManifest.Node.UserInstallPath.Value -like "H:/daz/Program Files/directory/Applications/Data/DAZ 3D/My DAZ 3D Library") | |
{ | |
# put here what you want it to change into, in my case the new location of my daz library | |
$DAZInstallManifest.Node.UserInstallPath.Value = "E:\daz\Program Files\directory\Applications\Data\DAZ 3D\My DAZ 3D Library" | |
} | |
# this saves the file | |
$dsx.Save($dsxobject.FullName) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment