wsl-backup/CreateBackup.ps1

9 lines
440 B
PowerShell
Raw Normal View History

2022-09-04 12:37:12 +02:00
[string]$backup_path="C:\Users\roger\SynologyDrive\Archiv\Backups\WSL\"
[string]$distro_name="Ubuntu-22.04"
Write-Output "Creating WSL Backup of distribution $distro_name..."
Get-ChildItem -Path $backup_path | Sort-Object LastWriteTime -Descending | Select-Object -Skip 3 | Remove-Item
2022-09-26 19:38:00 +02:00
wsl --export $distro_name $backup_path\${distro_name}_$((Get-Date).ToString('yyyy-MM-dd')).tar
2022-09-26 19:34:59 +02:00
#wsl --export $distro_name $backup_path\$distro_name.tar