Which tool/method is best to rename 10000 files in SharePoint?

Gitanjali Cloud Admin 20 Reputation points
2024-02-20T14:28:19.5833333+00:00

I was looking for a way to bulk rename the files in SharePoint online, I got to know that I can rename bulk file using pnp powershell, but is it possible to rename about 10000 files at a time time, if yes, the what will be the script?

Microsoft 365 and Office | SharePoint | For business | Windows
Windows for business | Windows Server | User experience | PowerShell
{count} votes

Accepted answer
  1. Emily Du-MSFT 51,851 Reputation points Microsoft External Staff
    2024-02-21T07:51:36.17+00:00

    You could use following PnP PowerShell to bulk rename files.

    1.Create a csv file as following picture shows. In the csv file, fill in the file URL and new file name.

    User's image

    2.Please run below PNP PowerShell.

    $SiteURL = "https://tenant.sharepoint.com/sites/emilytestnew"
    $filePath = "C:\Users\Administrator\Desktop\filename.csv"  
    $csv = Import-Csv $filePath  
    Connect-PnPOnline -Url $SiteURL -Interactive
    ForEach($Row in $csv) {  
        Rename-PnPFile -SiteRelativeUrl $Row.FileURL -TargetFileName $Row.NewFileName -Force
     }  
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.