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

  • Home
  • SEARCH
  • 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 805445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:04:53+00:00 2026-05-15T00:04:53+00:00

There are often times that I want to execute a command on all files

  • 0

There are often times that I want to execute a command on all files (including hidden files) in a directory. When I try using

chmod g+w * .*

it changes the permissions on all the files I want (in the directory) and all the files in the parent directory (that I want left alone).

Is there a wildcard that does the right thing or do I need to start using find?

  • 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-05-15T00:04:54+00:00Added an answer on May 15, 2026 at 12:04 am

    You will need two glob patterns to cover all the potential “dot files”: .[^.]* and ..?*.

    The first matches all directory entries with two or more characters where the first character is a dot and the second character is not a dot. The second picks up entries with three or more characters that start with .. (this excludes .. because it only has two characters and starts with a ., but includes (unlikely) entries like ..foo).

    chmod g+w .[^.]* ..?*
    

    This should work well in most all shells and is suitable for scripts.


    For regular interactive use, the patterns may be too difficult to remember. For those cases, your shell might have a more convenient way to skip . and ...
    zsh always excludes . and .. from patterns like .*.
    With bash, you have to use the GLOBIGNORE shell variable.

    # bash
    GLOBIGNORE=.:..
    echo .*
    

    You might consider setting GLOBIGNORE in one of your bash customization files (e.g. .bash_profile/.bash_login or .bashrc).
    Beware, however, becoming accustomed to this customization if you often use other environments.
    If you run a command like chmod g+w .* in an environment that is missing your customization, then you will unexpectedly end up including . and .. in your command.

    Additionally, you can configure the shells to include “dot files” in patterns that do not start with an explicit dot (e.g. *).

    # zsh
    setopt glob_dots
    
    # bash
    shopt -s dotglob
    
    
    # show all files, even “dot files”
    echo *
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It seems that often I will want to execute some methods from a Class
When make -ing under Vim, there is often a need to vimgrep the files.
There are often times I will grep -n whatever file to find what I
I listen to the podcast java posse, on this there is often discussion about
Are there anyone with experiences/examples on releasing early/releasing often for commercial software? Does it
The web applications I develop often require co-dependent configuration settings and there are also
There is a conversion process that is needed when migrating Visual Studio 2005 web
I'm using Delphi 2010 and I'm wondering if there's a way to trace through
I have a Java program that loads thirdparty class files (classes I did not
Often times convention is one of the most important design consideration for user interface.

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.