Skip to content

Commit aa28680

Browse files
committed
fix: Only delete the files we're supposed to
1 parent 7e7f2c6 commit aa28680

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

_InitializeRepository.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,17 @@ If you have made changes to any files you may want to commit them before continu
2121
Begin
2222
{
2323
$InformationPreference = 'Continue'
24-
[string] $RepositoryRoot = $PSScriptRoot
24+
[string] $RepositoryRoot = Resolve-Path -Path $PSScriptRoot
2525

2626
function Remove-AllRepositoryFilesExceptTemplateModuleFiles
2727
{
28-
Remove-Item -Path $RepositoryRoot\* -Recurse -Force -Exclude '.git\*','_InitializeRepository.ps1','src\Template.PowerShell.ScriptModule\*'
28+
Get-ChildItem -Path $RepositoryRoot -Recurse |
29+
Where-Object {
30+
$_.FullName -notlike "$RepositoryRoot\.git\*" -and # Don't delete the .git directory.
31+
$_.FullName -notlike "$RepositoryRoot\_InitializeRepository.ps1" -and # Don't delete this script.
32+
$_.FullName -notlike "$RepositoryRoot\src\Template.PowerShell.ScriptModule\*" # Don't delete the template module files.
33+
} |
34+
Remove-Item -Force
2935
}
3036

3137
function Copy-TemplateFilesToRepositoryRoot

0 commit comments

Comments
 (0)