add resolve path for flatten directory function

This commit is contained in:
David Refoua 2022-10-14 21:51:04 +03:30 committed by GitHub
parent 0b163d43ab
commit f05c77e53c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,6 +48,7 @@ function Create-Archive($source, $target, $params) {
# If directory contains only one child directory
# Flatten it instead
function Flatten-Directory($name) {
$name = Resolve-Path $name
$child = (Get-Childitem $name)[0]
Write-Verbose "Moving the '$child' directory's content to '$name'"
Rename-Item $name -NewName "$($name)_moving"