The reason it turned out to be a really useful script because -
- There were hundreds of folder and thousands of file to work with.
- It extracted the files while retaining the original folder structure. Which means that we can paste this folder back anytime we want and it will only updated the extracted files.
Sample script
$cutOff = Get-Date '01/01/2022 00:00'$source ="YOUR\SOURCE\FOLDER\LOCATION\HERE"$destination = "YOUR\DESTINATION\FOLDER\LOCATION\HERE"#Below line fetches all the files | Then check the last updated time | Then it loops through all the filesGet-ChildItem $source -File -Recurse | Where {( $_.LastWriteTime -ge $cutOff)} | ForEach {#Extract the full directory path without file name$actualSource = Split-Path $_.FullName#Replace the root source path with root destination path in order to get proper folder structure$actualDest = $actualSource.Replace($source, $destination)#copy file from source to destinationrobocopy $actualSource $actualDest $_.Name}