I need to copy everyday automatically, the files that were created or changed yesterday into a new folder(no syncronization only copy), I am trying with XCOPY but in the Date parameter do not accept variables.
This is the script.
PowerShell $date = Get-Date; $date=$date.AddDays(-1); $date.ToString(‘MM-dd-yyyy’)
xcopy C:\test C:\copy /D:$date /E
Any Idea?
The first time you run it will end up with the entire directory structure copied. This is because you’ve never ran a backup on those files before. (Note: You can manually turn off the attribute before the first run.) After that, it’ll be every file that has been modified since the last run.
EDIT:
Turn off archive attribute for a directory branch:
View files with archive attribute set:
How To Ask Questions The Smart Way