Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding($TRUE)
- $source = "G:\\2017.4.8f1\\2017.4.8f1\\2017.4.8f1\\"
- $destination = "G:\\2017.4.8f1\\2017.4.8f1\\2017.4.8f1\\"
- foreach ($i in Get-ChildItem -Recurse -Force) {
- if ($i.PSIsContainer) {
- continue
- }
- $path = $i.DirectoryName -replace $source, $destination
- $name = $i.Fullname -replace $source, $destination
- if(($i.Fullname -notlike "*.cpp") -and ($i.Fullname -notlike "*.h") ) {
- continue;
- }
- if ( !(Test-Path $path) ) {
- New-Item -Path $path -ItemType directory
- }
- $content = [IO.File]::ReadAllText($i.Fullname) -replace "`n","`r`n"
- if ( $content -ne $null ) {
- [System.IO.File]::WriteAllLines($name, $content, $Utf8NoBomEncoding)
- } else {
- Write-Host "No content from: $i"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement