title: Powershell get files older than x days and move them
body: <p>I am sure this might have been asked a million times before. I am very new to Power Shell and would like to ask if I am doing this right.</p>
  
  <p>In the directory, we have many files types. What I am trying to accomplish is to move only PDF files that are older than one month. To not even touch the other file extensions. The extensions in the folder are:</p>
  
  <p>pdf, xml, csv</p>
  
  <p>I have searched the forums prior to asking. This is what I have so far.</p>
  
  <p><code>get-childitem -path \\server\folder -include "*.pdf" -exclude "*.xml,*.csv" | where-object {$_.LastWriteTime -gt (get-date).AddDays(-31)} | move-item -destination \\server\folder\folder2</code></p>
  
  <p>One question though, how would you handle an exclude if there is no file extension?</p>
  
  <p>Thanks for your time and patience with this noob!</p>