allFileContents prefix (p:ps) = do
    isDir <- doesDirectoryExist (prefix ++ "/" ++ p)
    otherDirs <- allFileContents prefix ps
    if isDir
    then do
        ct <- showDirectory (prefix ++ "/" ++ p)
        dirCont <- allFileContents prefix (prefixSet (p ++ "/") ct)
        return (dirCont ++ otherDirs)
    else do
        return (p : otherDirs)


-- recursivly get all non-directory files
allFileContents prefix (p:ps) = do
    isDir <- doesDirectoryExist (prefix ++ "/" ++ p)
    otherDirs <- allFileContents prefix ps
    if isDir
    then do
        ct <- showDirectory (prefix ++ "/" ++ p)
        dirCont <- allFileContents prefix (prefixSet (p ++ "/") ct)
        return (dirCont ++ otherDirs)
    else do
        return (p : otherDirs)


-- recursivly get all non-directory files
allFileContents prefix (p:ps) = do
    isDir <- doesDirectoryExist (prefix ++ "/" ++ p)
    otherDirs <- allFileContents prefix ps
    if isDir
    then do
        ct <- showDirectory (prefix ++ "/" ++ p)
        dirCont <- allFileContents prefix (prefixSet (p ++ "/") ct)
        return (dirCont ++ otherDirs)
    else do
        return (p : otherDirs)


-- recursivly get all non-directory files