
@seb seb
An alternative is to use tools that can handle LVT. For example, Explorer. It will make successive requests and show the results in a Windows Explorer like way in your browser. (Use the trial version)
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I'm looking for a way to get the total number of files in a single directory of a sharepoint library (with more than 5000 items).
can you help me ?
thanks
seb
Hi @seb seb ,
Welcome to Q&A Forum!
Please run the below PowerShell script as an admin to get counts of files:
#Config Variables
$SiteURL = "https://domain.sharepoint.com/sites/sitename"
$ListName ="libraryname"
#Any file under the given path
$FolderServerRelativePath = "/sites/sitename/libraryname/foldername*" #Any file under the given path
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
#Get all files from folder
$Files = Get-PnPListItem -List $ListName | Where {$_.FieldValues.FileRef -like $FolderServerRelativePath -and $_.FileSystemObjectType -eq "File" }
Write-Host "File Counts:" $Files.Count
Thanks,
Echo Du
====================================
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.
Thanks but i have this message :
"Get-PnPListItem: The attempted operation is prohibited because it exceeds the threshold
list display."
thanks,
seb
This is a quick note to let you know that we are performing research on this issue.
Sync / add a shortcut to File Explorer. Then use file explore to right click, and see the count of all folders and files in the hierarchy. Kind of a pretty big oversight that you can't do this in SharePoint. You can only go to doc settings and see a full file count, but not a folder count.