From e16d17ed72e4227937dc412f8832624a417c8937 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Sun, 22 Nov 2015 03:27:20 +0100 Subject: [PATCH] Cosmesis --- Main.hs | 7 ++++--- hashrename.cabal | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Main.hs b/Main.hs index fec4c41..b2064a8 100644 --- a/Main.hs +++ b/Main.hs @@ -8,8 +8,8 @@ import System.FilePath.Posix import qualified Data.ByteString as B getDirectoryFiles :: FilePath -> IO [FilePath] -getDirectoryFiles path = - map (path ) <$> getDirectoryContents path >>= filterM doesFileExist +getDirectoryFiles path = map (path ) <$> + getDirectoryContents path >>= filterM doesFileExist fileHash :: FilePath -> IO String fileHash = fmap (hex . hash) . B.readFile @@ -28,6 +28,7 @@ newName path = do then return path else return new +main :: IO () main = do args <- getArgs path <- case args of @@ -41,4 +42,4 @@ main = do y' = takeFileName y putStrLn (printf "%s -> %s" x' y') renameFile x y - putStrLn "Files renamed successfully" \ No newline at end of file + putStrLn "Files renamed successfully" diff --git a/hashrename.cabal b/hashrename.cabal index 4fadd87..5a7d6ea 100644 --- a/hashrename.cabal +++ b/hashrename.cabal @@ -1,5 +1,5 @@ name: hashrename -version: 0.1.0.0 +version: 0.1.1.0 synopsis: Rename every file in a directory with his SHA1 hash. Perfect to clean messy folders. license: MIT license-file: LICENSE @@ -13,4 +13,4 @@ cabal-version: >=1.10 executable hashrename main-is: Main.hs build-depends: base >=4.8 && <4.9, directory, filepath, cryptohash, bytestring - default-language: Haskell2010 \ No newline at end of file + default-language: Haskell2010