Tue. Jun 7th, 2022
Function Rename-Files
{
 param ([string]$FilePath)

$files = Get-ChildItem $FilePath -Recurse

foreach ($File in $Files)
{

    $pos = $File.Name.IndexOf(".")
    $Left = $File.Name.Substring(0, $pos)
    $Right = $File.Name.Substring($pos)
    $DefaultFileName = $Left + '.aspx'

    if($DefaultFileName -eq "Home.aspx" -or $DefaultFileName -eq "How To Use This Library.aspx")
    {
        $pos = $File.Name.IndexOf(".")
        $Left = $File.Name.Substring(0, $pos)
        $Right = $File.Name.Substring($pos+1)
        $FullPath = $FilePath +'\'+$File.Name
        $NewName = $Left + '_SP2013.' + $Right  
        Rename-Item $FullPath -NewName $NewName
    }
}#Foreach

}

This website uses cookies. By continuing to use this site, you accept our use of cookies.