blob: d147b7ca35eed29b3458db8312a6517768db3a24 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
module FileUtils where
import Control.Monad
import System.FilePath
import System.Directory
copyRecursive :: FilePath -> FilePath -> IO ()
copyRecursive from to = do
doesDirectoryExist from >>= \case
False -> do
copyFile from to
True -> do
createDirectory to
content <- listDirectory from
forM_ content $ \name -> do
copyRecursive (from </> name) (to </> name)
copyRecursiveForce :: FilePath -> FilePath -> IO ()
copyRecursiveForce from to = do
doesDirectoryExist to >>= \case
False -> return ()
True -> removeDirectoryRecursive to
copyRecursive from to
|