getFiles :: String -> FilePath -> IO [FilePath]
getFiles ext dir =
   do (fs, ds) <- getDirectory (dir++"/")
      let files = filter (`endswith` ext) fs
      foldM recursive files ds
     where recursive rs d =
               do ms <- getFiles ext d
                  return $ ms ++ rs
getFiles :: String -> FilePath -> IO [FilePath]
getFiles ext dir =
   do (fs, ds) <- getDirectory (dir++"/")
      let files = filter (`endswith` ext) fs
      foldM recursive files ds
     where recursive rs d =
               do ms <- getFiles ext d
                  return $ ms ++ rs
getFiles ext dir =
   do (fs, ds) <- getDirectory (dir++"/")
      let files = filter (`endswith` ext) fs
      foldM recursive files ds
     where recursive rs d =
               do ms <- getFiles ext d
                  return $ ms ++ rs