[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash script problem



Hi,

On 2021-08-05 7:30 p.m., David wrote:
> On Fri, 6 Aug 2021 at 06:03, Gary L. Roach <garyroach719@gmail.com> wrote:
> 
>> Second, why am I separating out the Path the way I am doing? I need to
>> check each level for existence then, if the level doesn't exist, create
>> the directory, cd to the directory, set chown and -x chmod. After that
>> check the next level and repeat the process until I run out of levels.
>> There are other things that need to be done with files that are similar.
> 
> It sounds like you are unaware of 'mkdir -p' and 'chown -R'.
> They are the standard tools for this kind of task.
> 
> 'chmod -R' is less useful because it does not discriminate
> between files and directories, I never understood why it
> does not offer that option, because usually we need all file
> permissions to not be the same as all directory permissions.
> 
find . -type d -exec chmod -v 0644 '{}' \;

to change the folder

find . -type f -exec chmod -v 0755 '{}' \;

to change files

Here's how to discriminate

-- 
Polyna-Maude R.-Summerside
-Be smart, Be wise, Support opensource development

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


Reply to: