Hi @sns ,
First ,you can get all lists in SharePoint site and get all items from lists, then filter out the files of type ‘css‘ and ‘js’ ,finally , all the files that meet the conditions are output in csv format.
Here is an example of using PowerShell to achieve this effect ,” FileRef” will show the file from which library:
$siteUrl = "https://xxxx.sharepoint.com/sites/xxx"
$filePath = "C:\ New folder\xxx.csv"
Connect-PnPOnline -Url $siteUrl -Credentials (Get-Credential)
$site = Get-PnPWeb
$ExportTable = @()
# Get all libraries in sub webs
$curLibraries = Get-PnPList -Web $site | Where-Object{$_.BaseTemplate -eq 101}
foreach ($lib in $curLibraries)
{
$listItems = Get-PnPListItem -List $lib -Fields "FileRef", "FileLeafRef", "File_x0020_Type", "File_x0020_Size", "Created_x0020_By", "Created_x0020_Date", "Modified_x0020_By", "Modified" -Web $site
foreach ($item in $listItems)
{
if($item.FieldValues.File_x0020_Type -eq 'js' -or $item.FieldValues.File_x0020_Type -eq 'css'){
$ExportTable += New-Object psobject -Property @{
'FileRef' = $item.FieldValues.FileRef
'FileLeafRef' = $item.FieldValues.FileLeafRef
'Type' = $item.FieldValues.File_x0020_Type
'File_x0020_Size' = $item.FieldValues.File_x0020_Size
'Created_x0020_By' = $item.FieldValues.Created_x0020_By
'Created_x0020_Date' = $item.FieldValues.Created_x0020_Date
'Modified_x0020_By' = $item.FieldValues.Modified_x0020_By
'Modified' = $item.FieldValues.Modified
'SiteUrl' = $site.ServerRelativeUrl
'SiteName' = $site.Title
'UniqueID' = $item.FieldValues.UniqueId
}
}
}
}
# Export results into csv
$ExportTable | select FileRef, FileLeafRef, Type, File_x0020_Size, FileSizeDisplay, Author, Created_x0020_By, Created_x0020_Date, Editor, Modified_x0020_By, Modified, SiteUrl, SiteName, UniqueID | Export-Csv $filePath -NoTypeInformation
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.