Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding($TRUE)
  2. $source = "G:\\2017.4.8f1\\2017.4.8f1\\2017.4.8f1\\"
  3. $destination = "G:\\2017.4.8f1\\2017.4.8f1\\2017.4.8f1\\"
  4.  
  5. foreach ($i in Get-ChildItem -Recurse -Force) {
  6.  
  7. if ($i.PSIsContainer) {
  8. continue
  9. }
  10.  
  11. $path = $i.DirectoryName -replace $source, $destination
  12. $name = $i.Fullname -replace $source, $destination
  13.  
  14. if(($i.Fullname -notlike "*.cpp") -and ($i.Fullname -notlike "*.h") ) {
  15. continue;
  16. }
  17.  
  18. if ( !(Test-Path $path) ) {
  19. New-Item -Path $path -ItemType directory
  20. }
  21.  
  22.  
  23.  
  24. $content = [IO.File]::ReadAllText($i.Fullname) -replace "`n","`r`n"
  25.  
  26. if ( $content -ne $null ) {
  27.  
  28. [System.IO.File]::WriteAllLines($name, $content, $Utf8NoBomEncoding)
  29. } else {
  30. Write-Host "No content from: $i"
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement