Skip to content

Instantly share code, notes, and snippets.

@dwaldmannDE
Created January 19, 2019 17:50
Show Gist options
  • Save dwaldmannDE/0d5e4cc86570606d6c90b121d5e68bd7 to your computer and use it in GitHub Desktop.
Save dwaldmannDE/0d5e4cc86570606d6c90b121d5e68bd7 to your computer and use it in GitHub Desktop.
#CopyFromSD
$PathToExternalMedia = "D:\" #Pfad bzw. Laufwerksbuchstabe der SD-Karte
$PathToDestination = "C:\Users\Daniel\Pictures" #Pfad an den der Inhalt der SD-Karte kopiert wird
$FileList = Get-ChildItem -Path $PathToExternalMedia -Recurse -File
$i = 0
$FileCount = $FileList.Count
Write-Host "$FileCount files should be copied!"
foreach ($File in $FileList) {
$i = $i + 1
Write-Progress -Activity "Copy File from SD-Card" -Status "$($File.BaseName) - $i / $FileCount" -PercentComplete (($i*100)/$FileCount)
try {
Copy-Item -Path $File.FullName -Destination $PathToDestination -ErrorAction Stop
Write-Host "File with the Name $($File.BaseName) has been copied to $PathToDestination"
} catch {
Write-Warning "File with the Name $($File.BaseName) could not been copied to $PathToDestination"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment