Table of contents
Open Table of contents
들어가며
powershell
Commands
$folderPath = "C:\Users\rbstj\gyunseo.github.io\src\content\blog"
# Define the text to find and replace
$findText = "/src/assets/image/"
$replaceText = "https://res.cloudinary.com/gyunseo-blog/image/upload/v1698669625/"
# Get a list of all Markdown files in the folder
$markdownFiles = Get-ChildItem -Path $folderPath -Filter "*.md"
# Iterate through each Markdown file and perform the text replacement
foreach ($file in $markdownFiles) {
# Read the content of the file
$fileContent = Get-Content -Path $file.FullName -Raw
# Perform the text replacement
$newContent = $fileContent -replace $findText, $replaceText
# Write the updated content back to the file
Set-Content -Path $file.FullName -Value $newContent
}
Write-Host "Text replacement completed for all Markdown files in $folderPath."