<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>powershell get folder last access time Archives - the Sysadmin Channel</title>
	<atom:link href="https://thesysadminchannel.com/tag/powershell-get-folder-last-access-time/feed/" rel="self" type="application/rss+xml" />
	<link>https://thesysadminchannel.com/tag/powershell-get-folder-last-access-time/</link>
	<description>Documenting My Life as a System Administrator</description>
	<lastBuildDate>Tue, 10 Jul 2018 03:08:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
<site xmlns="com-wordpress:feed-additions:1">144174110</site>	<item>
		<title>List Directories That Haven&#8217;t Been Updated in X Amount Of Time Powershell</title>
		<link>https://thesysadminchannel.com/list-directories-that-havent-been-updated-in-x-time-powershell/</link>
					<comments>https://thesysadminchannel.com/list-directories-that-havent-been-updated-in-x-time-powershell/#respond</comments>
		
		<dc:creator><![CDATA[Paul Contreras]]></dc:creator>
		<pubDate>Tue, 03 Jul 2018 16:50:23 +0000</pubDate>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Server Administration]]></category>
		<category><![CDATA[find files not accessed in 30 days]]></category>
		<category><![CDATA[powershell get folder last access time]]></category>
		<category><![CDATA[powershell lastaccesstime lastwritetime]]></category>
		<category><![CDATA[use powershell to find files that have not been accessed]]></category>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=676</guid>

					<description><![CDATA[<p>How to list directories that haven&#8217;t been updated in X amount of time. To find this we&#8217;re going to use Get-ChildItem and the LastWriteTime property. Here is what the mini script looks like. List Directories That Haven&#8217;t Been Updated &#160;&#8230; <a href="https://thesysadminchannel.com/list-directories-that-havent-been-updated-in-x-time-powershell/" class="more-link">Continue Reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a href="https://thesysadminchannel.com/list-directories-that-havent-been-updated-in-x-time-powershell/">List Directories That Haven&#8217;t Been Updated in X Amount Of Time Powershell</a> appeared first on <a href="https://thesysadminchannel.com">the Sysadmin Channel</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>How to list directories that haven&#8217;t been updated in X amount of time.  To find this we&#8217;re going to use <strong>Get-ChildItem</strong> and the <strong>LastWriteTime</strong> property.  Here is what the mini script looks like.</p>
<h2>List Directories That Haven&#8217;t Been Updated</h2>
<pre class="brush: powershell; title: ; notranslate">
#Enter in the path to search for.
#Using the 'Recurse' switch will search through all sub-directories as well.
$Path = &quot;\\PAC-FS01\Apps&quot;

#Searching for directories that haven't been updated in 6 Months.
Get-ChildItem -Path $Path -Recurse -Directory | Where-Object {($_.LastWriteTime -lt (Get-Date).AddMonths(-6) )} | select FullName, LastWriteTime | Export-Csv C:\Oldfiles.csv -NoTypeInformation
</pre>
<p><a href="https://thesysadminchannel.com/wp-content/uploads/2018/07/Get-ChildItem-Recurse-Directory.png" target="_blank"><img fetchpriority="high" decoding="async" src="https://thesysadminchannel.com/wp-content/uploads/2018/07/Get-ChildItem-Recurse-Directory.png" alt="Get-ChildItem -Recurse -Directory" width="979" height="452" class="aligncenter size-full wp-image-741" srcset="https://thesysadminchannel.com/wp-content/uploads/2018/07/Get-ChildItem-Recurse-Directory.png 979w, https://thesysadminchannel.com/wp-content/uploads/2018/07/Get-ChildItem-Recurse-Directory-768x355.png 768w" sizes="(max-width: 979px) 100vw, 979px" /></a><br />
&nbsp;</p>
<p>Normally when a file is modified the parent directory will also show modified.  Here in my example I haven&#8217;t modified any files in my 2012 SCCM Setup Files.</p>
<p><a href="https://thesysadminchannel.com/wp-content/uploads/2018/07/Export-Csv-Old-Unmodified-directories.png" target="_blank"><img decoding="async" src="https://thesysadminchannel.com/wp-content/uploads/2018/07/Export-Csv-Old-Unmodified-directories.png" alt="Export-Csv Old Unmodified directories" width="788" height="377" class="aligncenter size-full wp-image-742" srcset="https://thesysadminchannel.com/wp-content/uploads/2018/07/Export-Csv-Old-Unmodified-directories.png 788w, https://thesysadminchannel.com/wp-content/uploads/2018/07/Export-Csv-Old-Unmodified-directories-768x367.png 768w" sizes="(max-width: 788px) 100vw, 788px" /></a><br />
&nbsp;</p>
<p><strong><em>Note:  Just because the file has not been modified doesn&#8217;t mean it hasn&#8217;t been accessed.</em></strong></p>
<p>Hopefully this little quick tip was enough to get you started. From here you can easily move the files and directories using the <a href="https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy" rel="noopener" target="_blank">Robocopy</a> cmdlet with the switches in the MS post.  Or if you&#8217;re feeling really brave, you can pipe the results to a <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/remove-item?view=powershell-6" rel="noopener" target="_blank">Remove-Item</a> to delete all those old files, however I would be very cautious before doing this and generally not recommend it.</p>
<p>As always, don&#8217;t forget to subscribe to our <a href="https://www.youtube.com/channel/UC9VnUjmZrNG3ithDZmG-S-g" rel="noopener" target="_blank">YouTube Channel</a> to get up to date sysadmin content.</p>
<p>The post <a href="https://thesysadminchannel.com/list-directories-that-havent-been-updated-in-x-time-powershell/">List Directories That Haven&#8217;t Been Updated in X Amount Of Time Powershell</a> appeared first on <a href="https://thesysadminchannel.com">the Sysadmin Channel</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://thesysadminchannel.com/list-directories-that-havent-been-updated-in-x-time-powershell/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">676</post-id>	</item>
	</channel>
</rss>
