Skip to content

Instantly share code, notes, and snippets.

@ghotz
Created September 29, 2015 05:59
Show Gist options
  • Save ghotz/11d2f189efdb568f836e to your computer and use it in GitHub Desktop.
Save ghotz/11d2f189efdb568f836e to your computer and use it in GitHub Desktop.
Checks that all pictures from a Windows Phone Lumia 1020 have been uploaded to OneDrive
#
# This script checks that all pictures from a Windows Phone Lumia 1020
# have been uploaded to OneDrive.
#
# It takes a local backup of the phone's Camera Roll directory copied directly
# from the phone and checks that all pictures are present in Onedrive's local
# copy of the Camera Roll directory.
#
# Note: the scripts assumes hires copies are automatically uploaded and
# removes pictures that are already present without the __highres suffix
# in the picture name.
#
$SourceDir = "D:\Backups\Phone\Pictures\Camera Roll";
$DestinationDir = "C:\Users\Gianluca\OneDrive\Pictures\Inbox Personal";
dir (Join-Path $SourceDir "*_panorama.jpg") | % {
# verify pictures have been achived
if (Get-ChildItem -Path $DestinationDir -Filter ($_.BaseName + ".jpg") -Recurse) {
Remove-Item $_
}
else {
Write-Output "$($_.BaseName) not found"
}
}
dir (Join-Path $SourceDir "*_Pro.jpg") | % {
$DirName = $_.DirectoryName;
$TestFilename = $_.BaseName + "__highres.jpg";
$TestFullName = Join-Path $DirName $TestFilename;
# verify that all lowres pictures have also hires copies
if (!(Test-Path $TestFullName)) { Write-Output "Highres picture $TestFullName not found"}
else {
# verify pictures have been achived
if (Get-ChildItem -Path $DestinationDir -Filter ($_.BaseName + ".jpg") -Recurse) {
Remove-Item $_
Remove-Item $TestFullName
}
else {
Write-Output "$($_.BaseName) not found"
}
}
}
Enter file contents here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment