Notifications
Clear all
BugOverflow
1
Posty
1
Users
0
Reactions
874
Widok
0
23/04/2021 11:50 pm
Topic starter
example script, ps1
1 Answer
0
23/04/2021 11:52 pm
Topic starter
#select files older than 2 hours $date = Get-Date $start_date = $date.AddHours(-2) #cleanup destination directory Remove-Item MY_DESITNATION_DIR* -Recurse #copy Get-ChildItem -Path Backup -File | Where-Object { $_.LastWriteTime -gt $start_date } | ForEach-Object { Copy-Item -Path MY_SOURCE_DIR$_ -Destination 'MY_DESITNATION_DIR' }