Skip to content

Instantly share code, notes, and snippets.

@takaki
Forked from Jxck/cleanup.hs
Created October 3, 2012 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takaki/3824943 to your computer and use it in GitHub Desktop.
Save takaki/3824943 to your computer and use it in GitHub Desktop.
cleanup without .hs files
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