title: Move files older than 90 days in a set of directories where the directory name contains certain text using batch or powershell
body: <p>I have a server where there are hundreds of sub directories, that may possibly contain files with a .flv extension that are older than 90 days.  I need to find these files, but only in the folders that have the word "ProdStream" in their name.  </p>
  
  <p>The purpose of this is to archive the files to AWS (I have a working script for this) with the original path of the file preserved in a log.</p>
  
  <p>I can find the files in all the sub folders using forfiles:</p>
  
  <pre><code>forfiles /P "SRC_PATH" /S /M *.flv /D -90 /C "cmd /C move @file "DEST_PATH""
  </code></pre>
  
  <p>However, forfiles doesn't allow me to use the folder name as a variable.  At least not in what I've tried.  So I tried using the for command.</p>
  
  <pre><code>set stream=SRC_PATH
  FOR /D /R %stream% %%X IN (ProdStream*) DO [something]
  </code></pre>
  
  <p>This works, but only partially as I can't find the right command to put after the DO to find the files.</p>
  
  <p>I also need to save the list of files with complete path information.  I have been using this:</p>
  
  <pre><code>forfiles /P "SRC_PATH" /S /M *.flv /D -90 /C "cmd /C echo @path @fsize" &gt;MY_LOG_FILE
  </code></pre>
  
  <p>Which works, but doesn't filter for the ProdStream text in the folder name.</p>
  
  <p>I am open to doing this in PowerShell as well as batch.</p>
  
  <p>My PowerShell is weak, but it can get stronger!</p>
  
  <p>Ideas?</p>
  
  <p>Server is Windows 2008 R2 Enterprise SP1</p>