Created
January 19, 2019 17:50
-
-
Save dwaldmannDE/0d5e4cc86570606d6c90b121d5e68bd7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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