Fix Copy-DirectoryContent for proper nested directory handling
Changed from iterating Get-ChildItem to using Copy-Item with wildcard
This ensures proper recursive copying of all files and subdirectories
Before: Get-ChildItem | ForEach-Object { Copy-Item ... }
After: Copy-Item -Path "$Source\*" -Destination $Destination -Recurse
This prevents issues where nested directories aren't copied correctly.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -260,10 +260,9 @@ function Copy-DirectoryContent {
|
||||
New-Item -Path $Destination -ItemType Directory -Force | Out-Null
|
||||
}
|
||||
|
||||
# Copy all items
|
||||
Get-ChildItem -Path $Source -Force | ForEach-Object {
|
||||
Copy-Item -Path $_.FullName -Destination $Destination -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
# Copy all contents from source to destination
|
||||
# Using -Container to properly handle nested directories
|
||||
Copy-Item -Path "$Source\*" -Destination $Destination -Recurse -Force -ErrorAction SilentlyContinue
|
||||
return $true
|
||||
}
|
||||
return $false
|
||||
|
||||
Reference in New Issue
Block a user