title: copying files from multiple subfolders using vba
body: <p>I've seen some documentation on this but so far, nothing that I've been able to replicate for my specific project.</p>
  
  <p>My code points at a directory that contains 60 or so subfolders. Within these subfolders are multiple files .PDF/.XLS etc. The following code works fine if the files are not embedded in the subfolders but what I need to do is be able to loop through the subfolders and pull the files themselves to move. Also, is there a way to eventually pull files by wildcard name? Thanks in advance for any help.</p>
  
  <pre><code>  Dim FSO As Object
    Dim FromPath As String
    Dim ToPath As String
    Dim Fdate As Date
    Dim FileInFromFolder As Object
  
    FromPath = "H:\testfrom\"
    ToPath = "H:\testto\"
  
    Set FSO = CreateObject("scripting.filesystemobject")
    For Each FileInFromFolder In FSO.getfolder(FromPath).Files
    Fdate = Int(FileInFromFolder.DateLastModified)
        If Fdate &gt;= Date - 1 Then
  
          FileInFromFolder.Copy ToPath
  
      End If
  Next FileInFromFolder
  End Sub
  </code></pre>