File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,22 @@ Begin
2525
2626 function Remove-AllRepositoryFilesExceptTemplateModuleFiles
2727 {
28- Get-ChildItem - Path $RepositoryRoot - Recurse |
28+ # Delete all files except the ones we want to keep.
29+ Get-ChildItem - Path $RepositoryRoot - Recurse - File |
2930 Where-Object {
3031 $_.FullName -notlike " $RepositoryRoot \.git\*" -and # Don't delete the .git directory.
3132 $_.FullName -notlike " $RepositoryRoot \_InitializeRepository.ps1" -and # Don't delete this script.
3233 $_.FullName -notlike " $RepositoryRoot \src\Template.PowerShell.ScriptModule\*" # Don't delete the template module files.
3334 } |
3435 Remove-Item - Force
36+
37+ # Delete all empty directories that were left behind.
38+ Get-ChildItem - Path $RepositoryRoot - Recurse - Directory |
39+ Sort-Object - Property FullName - Descending | # Delete child directories before parent directories.
40+ Where-Object {
41+ $_.GetFileSystemInfos ().Count -eq 0
42+ } |
43+ Remove-Item - Force
3544 }
3645
3746 function Copy-TemplateFilesToRepositoryRoot
You can’t perform that action at this time.
0 commit comments