Functions of NamesAndPaths

$pathTop = [Environment]::GetFolderPath('Desktop')
cd "$pathTop\ps"
. .\Func_Files.ps1

$kugiri = "`t"

# ps\Data に出力
function OutTxtNamesAndPaths{
    param(
        [string]$pathRoot,
        [string]$keyWild        
        )
    
    # ファイル名作成
    $nmRoot = Split-Path $pathRoot -Leaf
    $nmFileOut = "NamesAndPaths-$nmRoot.txt"
    $nmFileOut = CorrectName $nmFileOut

    # cd
    CdMyData
    # Out Root
    ("Root :" + $pathRoot) | Out-File -FilePath $nmFileOut
    # CI
    Write-Host "--------------------------------------"
    Write-Host "Wait. Now Getting ChildItem."
    $tSta = Get-Date
    $cnt =0
    $CI = Get-ChildItem $pathRoot -File -Recurse |where{$_.Name -like $keyWild} |
        ForEach-Object{
            ($_.Name + $kugiri + ($_.DirectoryName).Replace($pathRoot,"") ) `
             | Out-File -FilePath $nmFileOut -Append
             $cnt++
             if(($cnt % 500) -eq 1 ){Write-Host "$cnt Count"}         
        }
    $tSpan = ((Get-Date)-$tSta).totalseconds
    $strOut = ("$cnt Count "+[string](MyRound $tSpan 2)+" sec") 
    $strOut+"`r`n"+(Get-Date) | Out-File -FilePath $nmFileOut -Append
    Write-Host $strOut
    Write-Host "Exec - Out to $nmFileOut"
}

function SerchFilePathByTxt{
    param(
        $nameWild,
        $pathRoot        
        )
    # ファイル名作成
    $nmRoot = Split-Path $pathRoot -Leaf
    $nmTxt = "NamesAndPaths-$nmRoot.txt"
    $nmTxt = CorrectName $nmTxt

    CdMyData

    #get file-content
    $Contents = Get-Content $nmTxt

    foreach($el in $Contents){
        $nm = ($el -split $kugiri )[0]
        if($nm -like $nameWild){
            $aryPaths += ,@( ($el -split $kugiri )[1] )
        }
    }
    
    $aryPaths = $aryPaths | Sort-Object | Get-Unique # 重複を削除
    foreach($el in $aryPaths){
        $aryPathsOut += ,@($pathRoot + $el)
    }
    return $aryPathsOut
}