Ok, somehow my Google Photos got really messed up. I have duplicates upon duplicates of pictures and home videos. I’m trying to figure out how to deduplicate the pictures. I exported all the photos using google takeout. My plan is to deduplicate them, fix dates on them and then, delete all my photos and then upload the de-duplicated photos.
I have 500 10 GB files that I exported. It’s a lot of data. So, I wrote a script to extract all of the .zip files. But, I keep running into issues. It also appears that some .zip files are being skipped. I have a log file and the timestamps are sometimes 2 or 3 of these files in less than a minute. So, I’m trying to get verbose information sent to the file so I can see exactly what it did. I got that to work, but I want to also see it in console so I can check on it every so often rather than opening up the text file while it’s running.
Here is my script. Right now, it’s writing out the expand-archive only to console. I need it to also write to the text file.
$filepath = "G:\My Drive\Takeout\"
Get-ChildItem 'C:\users\David\desktop'
$filenames = Get-Childitem 'G:\My Drive\Takeout' takeout* | Sort Name
Write-Host "Start Date and Time " + (get-date).ToString()
foreach ($filename in $filenames) {
$filepath
$filename.name
(get-date).ToString()
Clear-Variable fullfilename
Clear-Variable fileoutput
Clear-Variable fulloutput
$fullfilename = $filepath + $filename.name
$fileoutput = $filename.Name + " Has started"
Write-Host $fileoutput
$fulloutput = (get-date).ToString() + " " + $fileoutput
Write-Host "fulloutput is " + $fulloutput
$fulloutput | Out-File -FilePath 'C:\users\David\desktop\log.txt' -Append
Expand-Archive $fullfilename 'G:\My Drive\Takeout Extracted' -Verbose | Tee-Object -FilePath 'C:\users\David\desktop\log.txt' -Append
Clear-Variable fullfilename
Clear-Variable fileoutput
Clear-Variable fulloutput
$fileoutput = $filename.Name + " Has completed"
Write-Host $fileoutput
$fulloutput = (get-date).ToString() + " " + $fileoutput
Write-Host "fulloutput is " + $fulloutput
$expandoutput | Out-File -FilePath 'C:\users\David\desktop\log.txt' -Append
$fulloutput | Out-File -FilePath 'C:\users\David\desktop\log.txt' -Append
#remove-item $filename.FullName
}