Skip to content

Commit b648116

Browse files
committed
Force overwriting of dot-files on new repos
1 parent 6b21f0a commit b648116

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ScriptModuleRepositoryTemplate/ScriptModuleRepositoryTemplate.psm1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ function CopyTemplateFilesToRepositoryRoot([string] $repositoryDirectoryPath)
7878
$repoDotFiles = Get-ChildItem -Path $repositoryDirectoryPath -Recurse -Force -Filter '_.*'
7979
$repoDotFiles | ForEach-Object {
8080
[string] $filePath = $_.FullName
81+
[string] $parentDirectory = Split-Path -Path $filePath -Parent
8182
[string] $newFileName = $_.Name -replace '^_\.', '.'
82-
Rename-Item -Path $filePath -NewName $newFileName -Force
83+
[string] $newFilePath = Join-Path -Path $parentDirectory -ChildPath $newFileName
84+
Move-Item -Path $filePath -Destination $newFilePath -Force
8385
}
8486
}
8587

0 commit comments

Comments
 (0)