Hi @DWTKBrook
I will recommend you to use pnp powershell method Get-PnPFolderItem
to get all items under a specific parent folder including folders and subfolders. Please refer to the following script
#Set Variables
$siteURL = "https://xxx.sharepoint.com/sites/xiexin"
$FolderURL = "/LibraryName/parentfolder" #Document Library Site Relative URL
$UserName="******@xxxx.onmicrosoft.com"
$Password = "******"
$SecurePassword = ConvertTo-SecureString -String $Password -AsPlainText -Force
$Cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $UserName, $SecurePassword
#connect to sharepoint online site using powershell
Connect-PnPOnline -Url $siteURL -Credentials $Cred
$items=Get-PnPFolderItem -FolderSiteRelativeUrl $FolderURL -Recursive
write-host -ForegroundColor Green $items.count
Here is the document for Get-PnPFolderItem, please make a reference.
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.