Cosmesis
This commit is contained in:
parent
04d0742ff0
commit
e16d17ed72
7
Main.hs
7
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"
|
||||
putStrLn "Files renamed successfully"
|
||||
|
@ -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
|
||||
default-language: Haskell2010
|
||||
|
Loading…
Reference in New Issue
Block a user