Skip to content

Instantly share code, notes, and snippets.

@HowardvanRooijen
Last active December 20, 2015 12:19
Show Gist options
  • Save HowardvanRooijen/6130144 to your computer and use it in GitHub Desktop.
Save HowardvanRooijen/6130144 to your computer and use it in GitHub Desktop.
Execute-BackupArchive.ps1 for backing up and archiving TeamCity backups
function Execute-BackupArchive
{
param
(
[string] $sourcePath,
[string] $destinationPath,
[int] $minimumAge
)
$archiveFilesPath = ($sourcePath + "\to_delete")
robocopy $sourcePath $archiveFilesPath /e /MOVE /MINAGE:$minimumAge
Remove-Item -Recurse -Force $archiveFilesPath
robocopy $sourcePath $destinationPath /e /MIR
}
Execute-BackupArchive "<SOURCE_DIRECTORY>" "<DESTINATION_DIRECTORY>" 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment