lumpynose

Untitled

Dec 17th, 2022 (edited)
1,401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PowerShell 0.81 KB | Source Code | 0 0
  1. $insomnia = Start-Process -FilePath "C:\home\lumpy\Insomnia.exe" -PassThru
  2.  
  3. $date = get-date -uformat '%Y-%m-%d'
  4.  
  5. write-output $date
  6.  
  7. $backupDir = "e:\$date"
  8.  
  9. if (Test-Path -Path $backupDir) {
  10.     write-output "$backupDir exists"
  11. }
  12. else {
  13.     New-Item -Path $backupDir -ItemType Directory
  14. }
  15.  
  16. $dirs = @( "c:\home\lumpy", "f:\audio", "f:\pics" )
  17. foreach ( $dir in $dirs ) {
  18.     $destDir = Split-Path $dir -Leaf
  19.  
  20.     write-output "$dir -> $backupDir\$destDir"
  21.  
  22.     robocopy $dir $backupDir\$destDir /mir /mt:32 /log+:$backupDir\log+.txt
  23. }
  24.  
  25. $files = @( "music.rar", "copyall-x.ps1", "copyall-z.ps1", "copyall-*" )
  26.  
  27. foreach ( $file in $files ) {
  28.     write-output "$file"
  29.  
  30.     Copy-Item  -Path f:\$file -Destination $backupDir\$file -recurse -Force
  31. }
  32.  
  33. Get-Date
  34.  
  35. Stop-Process -InputObject $insomnia
  36.  
Advertisement
Add Comment
Please, Sign In to add comment