Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8792479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:59:03+00:00 2026-06-13T22:59:03+00:00

In bash how would one output the non-readable contents of a directory? For example,

  • 0

In bash how would one output the non-readable contents of a directory?

For example, let’s say the directory is ~/foo, and there’s a non-readable folder ~/foo/folder with a file ~/foo/folder/file1.txt, and another non-readable file ~/foo/file2.txt. I want to output:

~/foo/folder cannot be read.
~/foo/folder/file1.txt cannot be read.
~/foo/file2.txt cannot be read.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:59:04+00:00Added an answer on June 13, 2026 at 10:59 pm

    If you cannot read folder ~/foo/folder, there’s no way for you to detect any files in it, be they readable or not.

    If you can read ~/foo, you can go over all files and directories and test, wether they are readable or not:

    find ~/foo | while read file; do
        if test \! -r "$file"; then
            echo "$file cannot be read"
        fi
    done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to make tab completion in bash a bit more intelligent. Let's
With /bin/bash , how would I detect if a user has a specific directory
When working with Bash, I can put the output of one command into another
Consider the following Bash command lines: time ls # Sends directory contents to stdout
As an example consider the following bash script. There are two loops, the first
I would like the output of one process created with proc_open to be piped
I am writing a bash script that will output a .tgz file to a
Say I execute a bash script and the output is: Test1: Some text... Test2:
Consider the following example Bash one-liner in which the letters h, e and o
I am interested into getting into bash scripting and would like to know how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.