linux - test if all files in directory have correct permissions -


how can test if files in directory have correct permissions ? using command stat --format %a /home/user/dir/* can permissions of files in directory in multi line string. let's want check if files have permissions 0700.

i use if [ "$(stat --format %a ~/file)" != 600 ]; chmod 0600 ~/file; fi single file, how can test multiple files ?

could try this?

for in ~/your_dir/*/*  if [ "$(stat --format %a $i)" != 600 ];   chmod 0600 $i  fi done 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -