-
-
Save takaki/3824943 to your computer and use it in GitHub Desktop.
cleanup without .hs files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Directory | |
import Data.List | |
forRemove :: (String, String) -> Bool | |
forRemove (_, ".") = False | |
forRemove (_, "..") = False | |
forRemove (_, ".hs") = False | |
forRemove (_, ".git") = False | |
forRemove ("cleanup", _) = False | |
forRemove _ = True | |
main = do | |
c <- getCurrentDirectory >>= getDirectoryContents | |
mapM_ putStrLn $ filter (forRemove . span (/= '.')) c | |
-- mapM_ removeFile $ filter (forRemove . span (/= '.')) c | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment