Last active
April 13, 2017 11:18
-
-
Save JustusAdam/5faab5a741a9d5d3fd2f9d096bdc35d8 to your computer and use it in GitHub Desktop.
Renames all direcories in the working directory by stripping a prefix. Leaves those who dont match the prefix unchanged.
This file contains hidden or 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
| -- Renames all direcories in the working directory by stripping a prefix | |
| -- Leaves those who dont match the prefix unchanged. | |
| import System.Directory | |
| import Data.List | |
| import System.Environment | |
| import Control.Monad.Extra | |
| main = getArgs >>= \[prefix] -> | |
| listDirectory "." >>= filterM doesDirectoryExist >>= mapM_ (maybe (return()) (renameDirectory <$> (prefix++) <*> id) . stripPrefix prefix) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment