System.Directory module provides
removeDirectoryRecursive function, which remove the directory, together with
its contents and subdirectories. Following is the signature of removeDirectoryRecursive
function.
Prelude System.Directory> :t
removeDirectoryRecursive
removeDirectoryRecursive :: FilePath
-> IO ()
DirectoryUtil.hs
{- Take directory name as input and create a directory -} import System.IO import System.Directory main = do putStrLn "Enter directory full path to remove" direcotryName <- getLine removeDirectoryRecursive direcotryName putStrLn "Directory removed"
$ du -hc /Users/harikrishna_gurram/today 0B /Users/harikrishna_gurram/today/evenings/123 0B /Users/harikrishna_gurram/today/evenings/234 0B /Users/harikrishna_gurram/today/evenings 4.0K /Users/harikrishna_gurram/today 4.0K total $ $ runghc DirectoryUtil.hs Enter directory full path to remove /Users/harikrishna_gurram/today Directory removed $ $ du -hc /Users/harikrishna_gurram/today du: /Users/harikrishna_gurram/today: No such file or directory 0B total
No comments:
Post a Comment