[kwlug-disc] chown .* without traversing directories?

Paul Nijjar paul_nijjar at yahoo.ca
Fri Dec 9 15:06:02 EST 2022



Does 

find . -name '.*' -type f 

list the files you want to change permissions for? (This lists
dotfiles, not dot-directories. Remove the '-f' to get both). 

Once you have the right invocation of find you can chain on a
non-recursive chown:

find . -name '.*' -type f -exec chown www-data: {} \;

will change ownership of all dotfiles from this directory down to
www-data. 

Khalid's warnings in his other message still apply, of course. 

I am not very good with globs, so my tendency is to avoid recursive
invocations of commands unless the pattern is really easy. I use
`find` to iterate non-destructively, and then chain the command call
when I am confident I have things right.

- Paul


On Fri, Dec 09, 2022 at 01:04:49AM -0800, Ronald Barnes wrote:
> 
> Hey,
> 
> I'm trying to chown some "dot" files but I do not want to traverse UP the
> directory tree, but I do want to recursively traverse subdirectories.
> 
> 
> If I run:
> 
> chown -vR www-data: ./.*
> 
> 
> It goes up (towards / aka root), but I don't want that.
> 
> 
> What am I overlooking here?  Seems I'm overlooking something very obvious.
> 
> 
> 
> Thanks,
> 
> rb
> 
> _______________________________________________
> kwlug-disc mailing list
> To unsubscribe, send an email to kwlug-disc-leave at kwlug.org
> with the subject "unsubscribe", or email
> kwlug-disc-owner at kwlug.org to contact a human being.

-- 
Events: https://feeds.off-topic.kwlug.org 
Housing: https://unionsd.coop
Blog: http://pnijjar.freeshell.org




More information about the kwlug-disc mailing list