I am trying to Sync a large number of files from a folder on the server into a cloudberry bucket for all files where the date today is the same as the last modified date for that file.
This codes syncs successfully, but it syncs all files in the folder, not just files with a lastwritetime
after the $date
, even when I changed the date to be a date a month in the future, all the files still synced.
I have attempted to find the solution online, but none of the solutions works for a $temp
object of type CloudBerryLab.Explorer.PSSnapIn.Object.CloudFolder
.
What am I doing wrong?
Add-PSSnapin CloudBerryLab.Explorer.PSSnapIn
Set-CloudOption -PathStyle VHost
$date = Get-Date -Hour 0 -Minute 00 -Second 00
$s3 = Get-CloudS3Connection -Key XXXX -Secret XXXX
$source = Get-CloudFilesystemConnection | Select-CloudFolder -Path "//server1/XXXX/XXX"
$temp = $s3 | Select-CloudFolder -path "bucket/XXXX/"
$source | Copy-CloudSyncFolders $temp | Where-Object –Filter { $PSItem.LastWriteTime –ge $date}