Quantcast
Channel: SharePoint Diary
Viewing all articles
Browse latest Browse all 1058

Rename Files / Find and Replace File Names in SharePoint Document Library with PowerShell

$
0
0
Here is the PowerShell script to rename all files in bulk in SharePoint library:
 #Get the Web  
 $Web = Get-SPWeb "http://sharepoint.brightpoint.com"

 #Get the List
 $List = $Web.Lists["Design Documents"]
            
 #Iterate Through All List Items
  foreach($ListItem in $List.Items)
    {
      if($null -ne $ListItem.File) #Exclude Document Sets
        {
              Write-Host "Checking $($ListItem.Name)..."
              #Check out, if Require checkout is enabled
              #$ListItem.File.CheckOut()
              #Replace "Crescent" with "Crescent Inc."
              $ListItem["Name"] = $ListItem["Name"].replace("Crescent","Crescent Inc.")
              #Update the changes
              $ListItem.Update()
              #$ListItem.File.CheckIn("Updated the File Name")
        }
    }

Viewing all articles
Browse latest Browse all 1058

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>