Skip to content

Instantly share code, notes, and snippets.

View Zlate87's full-sized avatar
🏠
Working from home

Zlatko Stamatov Zlate87

🏠
Working from home
  • CARIAD
  • Berlin, Germany
View GitHub Profile
import System.Directory
import Control.Monad (filterM, mapM, liftM)
import System.FilePath ((</>))
getDirsRec :: FilePath -> IO [FilePath]
getDirsRec d = do
dirContents <- getDirectoryContents d
let dirContents' = [ d </> x | x <- dirContents, x /= ".", x /= ".." ]
dirs' <- mapM dirRec dirContents'
return (concat dirs' ++ [d])