resolve child path

This commit is contained in:
David Refoua 2022-10-15 01:47:22 +03:30 committed by GitHub
parent d7d0f1320b
commit 5831fa4977
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,7 +51,7 @@ function Flatten-Directory($name) {
$name = Resolve-Path $name $name = Resolve-Path $name
$moving = "$($name)_moving" $moving = "$($name)_moving"
Rename-Item $name -NewName $moving Rename-Item $name -NewName $moving
$child = (Get-Childitem $moving)[0] $child = Resolve-Path (Get-Childitem $moving)[0]
Write-Verbose "Moving the '$child' directory to '$name'" Write-Verbose "Moving the '$child' directory to '$name'"
Move-Item -Path $child -Destination $name Move-Item -Path $child -Destination $name
Remove-Item -Recurse $moving Remove-Item -Recurse $moving