0

I'm a Windows user and wondering: how can I do a backup for the files on a specific folder if the files are not older than x days? Or to backup only the newly added/modified files without doing a full backup before it?

0

I created a powershell code to do that which can be schadualed, It backup the files that is less than 60 days old and delete the backed-up files and folders if they are more than 60 days old

$src = "D:\Projects"
$dest = "G:\Backup\Projects"
$period = 60
$log_file = "G:\Backup\Logs\backup_" + (Get-Date -UFormat "%Y%m%dT%H%M%S") + ".txt"
robocopy $src $dest /MAXAGE:$period /S /TEE /NP /log:$log_file
forfiles -p $dest -s -m *.* /d -$period /C "cmd /c del @path"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.