printAllFiles :: FilePath -> Int -> IO()
printAllFiles p f = do
    if (f .&. 8 /= 0)
        then putStrLn (p ++ ":")
        else return ()
    strm <- openDirStream p
    files <- listAllFiles strm f
    if (f .&. 2 /= 0)
        then printDetailList p (sort files)
        else printList files 80
    closeDirStream strm
    if (f .&. 8 /= 0) then putStrLn "" else return ()
    if (f .&. 4 /= 0)
        then do
            recursivePrint p files f
        else return()    
printAllFiles :: FilePath -> Int -> IO()
printAllFiles p f = do
    if (f .&. 8 /= 0)
        then putStrLn (p ++ ":")
        else return ()
    strm <- openDirStream p
    files <- listAllFiles strm f
    if (f .&. 2 /= 0)
        then printDetailList p (sort files)
        else printList files 80
    closeDirStream strm
    if (f .&. 8 /= 0) then putStrLn "" else return ()
    if (f .&. 4 /= 0)
        then do
            recursivePrint p files f
        else return()    
printAllFiles p f = do
    if (f .&. 8 /= 0)
        then putStrLn (p ++ ":")
        else return ()
    strm <- openDirStream p
    files <- listAllFiles strm f
    if (f .&. 2 /= 0)
        then printDetailList p (sort files)
        else printList files 80
    closeDirStream strm
    if (f .&. 8 /= 0) then putStrLn "" else return ()
    if (f .&. 4 /= 0)
        then do
            recursivePrint p files f
        else return()    