mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-15 17:30:37 -06:00
Code Formatting Changes - 'Copy-Files' Private Function
This commit is contained in:
parent
dbf3aa2d5c
commit
b7b64170d5
@ -21,27 +21,22 @@ function Copy-Files {
|
||||
$files = Get-ChildItem -Path $path -Recurse:$recurse
|
||||
Write-Host "Copy $($files.Count)(s) from $path to $destination"
|
||||
|
||||
foreach($file in $files)
|
||||
{
|
||||
foreach ($file in $files) {
|
||||
$status = "Copy files {0} on {1}: {2}" -f $counter, $files.Count, $file.Name
|
||||
Write-Progress -Activity "Copy Windows files" -Status $status -PercentComplete ($counter++/$files.count*100)
|
||||
$restpath = $file.FullName -Replace $path, ''
|
||||
|
||||
if($file.PSIsContainer -eq $true)
|
||||
{
|
||||
if ($file.PSIsContainer -eq $true) {
|
||||
Write-Debug "Creating $($destination + $restpath)"
|
||||
New-Item ($destination+$restpath) -Force:$force -Type Directory -ErrorAction SilentlyContinue
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Write-Debug "Copy from $($file.FullName) to $($destination+$restpath)"
|
||||
Copy-Item $file.FullName ($destination+$restpath) -ErrorAction SilentlyContinue -Force:$force
|
||||
Set-ItemProperty -Path ($destination+$restpath) -Name IsReadOnly -Value $false
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Copy Windows files" -Status "Ready" -Completed
|
||||
}
|
||||
Catch{
|
||||
} catch {
|
||||
Write-Warning "Unable to Copy all the files due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user