Robocopy Source  Target / R:0 /W:0 /MIR

Extract files accessed within the last 30 days

robocopy E:\company E:\Date-30 /S /ZB /COPYALL /DCOPY:T /MAXAGE:30 /LOG:E:\log.txt /TEE

Explanation of the options used in the script:

/E: Copy subdirectories, including empty ones.
/S copy subdirectories – not empty ones
/ZB: Use restartable mode (if the copy is interrupted, it can be resumed).

/COPYALL: Copy all file information (permissions, attributes, timestamps, owner, and audit information).
/DCOPY:T: Copy folder timestamps.
/MAXAGE:30: Copy files that have been modified in the last 30 days (adjust as needed).
/LOG:”%log%”: Log the results to a specified log file. You can change the path to where you want the log to be saved.
/TEE: Display the output in the console and also log it to the file.
Make sure to replace C:\source_folder with the path of your source folder and D:\destination_folder with the path of your destination folder. You can also adjust the /MAXAGE parameter to change the time frame for files that should be copied.