functions/Do-Backup.ps1
function Copy-Backup ( [cmdletbinding()] [Parameter(Mandatory=$false)] [string]$Path = ".", $excludes = $null ) { $curpath=$Path $fullpath = (get-item $curpath).FullName #if ($curpath -eq $null) { #$curpath= [System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Definition) #} $backupdir="$curpath\..\_backup\" $date=Get-Date -Format "yyyy-MM-dd_HH_mm" $projectName=Split-Path -Leaf $curpath $tsdir=Join-Path $projectName "$projectName-$date" if ($excludes -eq $null) { if (test-path "$curPath\backup-excludes.txt") { $excludes = Get-Content "$curPath\backup-excludes.txt" } else { $excludes = @("log/", "App_Data/") } } $targetdir=Join-Path $backupdir $tsdir write-host "backup $curPath to $targetdir" beam.serverside.new\Copy-ItemFiltered -SourceDir $curpath -TargetDir $targetdir -Excludes $excludes -message "doing backup of '$fullpath'" $date >> "$curpath\backedup-$date.bkts" #copy -Recurse "$curpath/*" $targetdir -Verbose -Container -Exclude $excludes -Force } new-alias Do-Backup Copy-Backup -force |