
[기타] 특정 경로에 있는 모든 파일(XML)의 내용 변경하는 방법 (feat. PowerShell)
기타
2023. 8. 1. 12:15
Windows환경에서 PowerShell을 이용하면 특정 경로에 있는 특정파일의 모든 내용을 변경할 수 있다. ( geoserver의 datastore id값을 변경할 일이 있어서 씀.. 직접 변경하려면 공수가 너무 들어서... ) 샘플코드 # 수정할 디렉터리 경로 $directoryPath = "C:\Path\To\Your\Directory" # 수정할 문자열 $oldString = "old_string" $newString = "new_string" # 디렉터리 내의 모든 XML 파일 가져오기 $xmlFiles = Get-ChildItem -Path $directoryPath -Filter "*.xml" -Recurse # 각 XML 파일을 열고 내용 수정하기 foreach ($xmlFile in $..