Advertisement
Guest User

Untitled

a guest
Jan 19th, 2021
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Move-Recursively
  2. {
  3.     [CmdletBinding()]
  4.     param
  5.     (
  6.         [Parameter(Mandatory = $true)]
  7.         [string]
  8.         $Source,
  9.  
  10.         [Parameter(Mandatory = $true)]
  11.         [string]
  12.         $Destination
  13.     )
  14.  
  15.     $split = [regex]::escape([io.path]::getfilename($Source))
  16.     $arr = $_.DirectoryName -split "($split)"
  17.     $c = -join $arr[2..$arr.Length]
  18.     $fdst = $Destination + $c
  19.  
  20.     if (-not (Test-Path -LiteralPath $fdst))
  21.     {
  22.         New-Item -Path $fdst -ItemType Directory -Force
  23.     }
  24.     Move-Item -LiteralPath $Source.FullName -Destination $fdst -Force
  25.  
  26.     $Source = Get-Item -LiteralPath $Source
  27.     $Destination = Get-Item -LiteralPath $Destination
  28.  
  29.     # Moving files saving structure
  30.     Get-ChildItem -LiteralPath $_.FullName -Recurse -File -Force | Move-Recursively $Source.FullName $Destination.FullName
  31. }
  32.  
  33. # Исходный и целевой каталоги
  34. $Source = "$DownloadsFolder\Metro\UPMetroSkin-master\Unofficial 4.x Patch\Main Files [Install First]"
  35. $Destination = "$DownloadsFolder\Metro\metro-for-steam-4.4"
  36.  
  37. Move-Recursively -Source $Source -Destination $Destination
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement