{"id":4527,"date":"2015-07-24T09:56:18","date_gmt":"2015-07-24T09:56:18","guid":{"rendered":"http:\/\/ngenioussolutions.com\/blog\/?p=88"},"modified":"2025-12-01T13:11:41","modified_gmt":"2025-12-01T13:11:41","slug":"get-extract-of-files-modified-after-particular-date-from-sharepoint-library-or-folder-within-library-powershell-script","status":"publish","type":"post","link":"https:\/\/ngenioussolutions.com\/blog\/get-extract-of-files-modified-after-particular-date-from-sharepoint-library-or-folder-within-library-powershell-script\/","title":{"rendered":"PowerShell Script: Find Files Modified After a Specific Date"},"content":{"rendered":"<h2>Find Files Modified After a Specific Date in SharePoint Library (PowerShell Script)<\/h2>\n<p>Have you ever struggled to locate files modified after a certain date in your SharePoint library? Scrolling endlessly or manually checking each file can be tedious and time-consuming. This manual process can lead to frustration, wasted time, and even errors if files are missed. Without a streamlined method, managing files in SharePoint becomes inconvenient, slowing down productivity and causing unnecessary stress.<\/p>\n<p>In this guide, we&#8217;ll walk you through the process step-by-step with a custom PowerShell script to find files modified after a specified date in SharePoint, with this you can effortlessly pinpoint the exact files you need, streamlining your workflow and eliminating the hassle of manual searching.<\/p>\n<div style=\"font-size: 15px;\">\n<p>Function getFilesWithin($list)<br \/>\n{<br \/>\nforeach($item in $list.Items)<br \/>\n{<br \/>\nif ($folderURL -ne &#8220;&#8221;)<br \/>\n{<br \/>\nif ($item.Url.StartsWith($folderURL, &#8220;CurrentCultureIgnoreCase&#8221;))<br \/>\n{<br \/>\n$targetFile = $item.file;<br \/>\nif ($targetFile.TimeLastModified -ge (Get-Date $lastDate)){<br \/>\n$item.Name + &#8220;;&#8221; + $item.Url + &#8220;;&#8221; + &#8220;File;&#8221; + $($targetFile.TimeLastModified).ToString(&#8216;dd\/MM\/yyyy&#8217;) | Out-File $logWrite -Append<br \/>\n} else {<br \/>\nwrite-host -f green &#8220;Not changed after given date&#8221; + $item.Url<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n$targetFile = $item.file;<br \/>\nif ($targetFile.TimeLastModified -ge (Get-Date $lastDate)){<br \/>\n$item.Name + &#8220;;&#8221; + $item.Url + &#8220;;&#8221; + &#8220;File;&#8221; + $($targetFile.TimeLastModified).ToString(&#8216;dd\/MM\/yyyy&#8217;) | Out-File $logWrite -Append<br \/>\n} else {<br \/>\nwrite-host -f green &#8220;Not changed after given date&#8221; + $item.Url<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\n}<\/p>\n<p>$snapin = Get-PSSnapin | Where-Object { $_.Name -eq &#8220;Microsoft.SharePoint.Powershell&#8221; }<br \/>\nif ($snapin -eq $null) {<br \/>\nWrite-Host &#8220;[INIT] Loading SharePoint Powershell Snapin&#8221;<br \/>\nAdd-PSSnapin &#8220;Microsoft.SharePoint.Powershell&#8221;<br \/>\n}<\/p>\n<p>#****PARAMETRES DEFINITION****<br \/>\n#Specify <strong>web site URL<\/strong> wherein Document Library exists<br \/>\n$web= Get-SpWeb &#8220;http:\/\/w2k8sp2010dev01:13432\/&#8221;<br \/>\n#Specify <strong>Title of Document Library<\/strong><br \/>\n$DocLibName = &#8220;Shared Documents&#8221;<br \/>\n#Specify <strong>Folder URL<\/strong> if in case any specific documents within folder has to be worked upon or keep blank<br \/>\n$folderURL = &#8220;&#8221;<br \/>\n#<strong>Log File Name<\/strong>, will be suffixed by date time<br \/>\n$LogFileName = &#8220;Get_LibFiles_ModifiedAfter_Log&#8221;<br \/>\n#Specify <strong>date after which files modified<\/strong> should be extracted<br \/>\n$lastDate = &#8220;2015-01-30&#8221;<br \/>\n#****PARAMETRES DEFINITION****<\/p>\n<p>$LogFileName = $($LogFileName) + &#8220;@&#8221; + $(Get-Date -format MMddyy) + &#8220;.csv&#8221;<br \/>\nwrite-host -f RED $LogFileName<\/p>\n<p>set-variable -option constant -name logWrite -value $($LogFileName)<br \/>\n&#8220;File Name;File URL;Type;Last Modified&#8221; | Out-File $logWrite -Append<\/p>\n<p>write-host -f White &#8220;Connected to Web&#8221;<br \/>\n$Lib=$web.Lists.TryGetList($DocLibName)<br \/>\nwrite-host -f White &#8220;Connected to Library&#8221;<\/p>\n<p>if ($Lib.LastItemModifiedDate -ge (Get-Date $lastDate)){<br \/>\nwrite-host -f yellow &#8220;Changed after given date &#8221; + $($Lib.LastItemModifiedDate)<br \/>\n} else {<br \/>\nwrite-host -f green &#8220;Not changed after given date&#8221;<br \/>\n}<\/p>\n<p>getFilesWithin($Lib)<\/p>\n<p>$web.Dispose();<br \/>\n<strong><br \/>\n**************SCRIPT ENDS HERE***************<\/strong><\/p>\n<\/div>\n<p><strong>Instructions to use the above Power-shell script;<\/strong><br \/>\nYou will need to change parameter values and below are the definition of parameters;<\/p>\n<p>1. Web Site URL &#8211; Specify web site URL<\/p>\n<p>2. Title of Document Library &#8211; Specify Document Library Name<\/p>\n<p>3. Folder URL &#8211; Specify Folder URL starting with Library Name For E.g. &#8220;shared documents\/folder name&#8221;<\/p>\n<p>4. Log File Name &#8211; Specify Log File Name<\/p>\n<p>5. Date after which files modified &#8211; Specify Date criteria (should be in format of \u201cyyyy-mm-dd\u201d)<\/p>\n<div style=\"background-color: #efefef; margin-top: 30px; padding: 20px 30px; text-align: left; border-radius: 3px;\">\n<p><span style=\"font-size: 18px; font-weight: 500;\">Related Article:<\/span><\/p>\n<ul style=\"font-size: 21px;\">\n<li><a href=\"https:\/\/ngenioussolutions.com\/blog\/how-to-update-sharepoints-group-owner-using-powershell\/\">How to update SharePoint\u2019s Group Owner using PowerShell<\/a><\/li>\n<li style=\"margin-top: 10px;\"><a href=\"https:\/\/ngenioussolutions.com\/blog\/blog-delete-all-sharepoint-list-item-using-powershell\/\">Delete all sharepoint list item using powershell<\/a><\/li>\n<li style=\"margin-top: 10px;\"><a href=\"https:\/\/ngenioussolutions.com\/blog\/bulk-delete-sharepoint-list-items-using-csom\/\">Bulk delete SharePoint List items using CSOM<\/a><\/li>\n<li style=\"margin-top: 10px;\"><a href=\"https:\/\/ngenioussolutions.com\/blog\/window-scroll-event-is-not-firing-in-sharepoint\/\">Window scroll event is not firing in SharePoint<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Find Files Modified After a Specific Date in SharePoint Library (PowerShell Script) Have you ever struggled to locate files modified after a certain date in&#8230;<\/p>\n","protected":false},"author":1,"featured_media":8598,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4527","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-others"],"menu_order":0,"_links":{"self":[{"href":"https:\/\/ngenioussolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4527","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ngenioussolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ngenioussolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ngenioussolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ngenioussolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=4527"}],"version-history":[{"count":10,"href":"https:\/\/ngenioussolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4527\/revisions"}],"predecessor-version":[{"id":12490,"href":"https:\/\/ngenioussolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4527\/revisions\/12490"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ngenioussolutions.com\/blog\/wp-json\/wp\/v2\/media\/8598"}],"wp:attachment":[{"href":"https:\/\/ngenioussolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=4527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ngenioussolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=4527"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ngenioussolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=4527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}