Setting read only based on modification time

Hi all

first a setup scenario
create 3 files with modification date 1, 2, and 3 days ago
as stated in the find line it should only do something to the files 2 and 3 days old
find . -mtime +2 works fine and only displays the 2 files but running the entire line sets all files to read only.

i hope that someone here can help me out with this cause i'm stuck
i advance thanks

Masterdraco

_dir="${1:-.}"
_fperm="0444"
_dperm="0445"
_ugperm="root:wheel"
_chmod="/bin/chmod"
_chown="/usr/sbin/chown"
_find="/usr/sbin/find"
_xargs="/usr/bin/xargs"

find "$_dir" -mtime +2 | $_chown -R "${_ugperm}" "$_dir" | $_chmod -R "${_fperm}" "$_dir" | find "$_dir" -type d -print0 | $_xargs -0 -I {} $_chmod $_dperm {}

Merely an opinion: cramming dozens of command onto one line is cool. And horrible to maintain.

As a result, my answer would be to break that up, and then I could suggest where you could insert a single command line to solve your question. Some one else who is a one-line lover could maybe help you. I draw the line on this as the question is stated.

Merely an opinion: cramming dozens of commands onto one line is not cool.

Why the pipe to the second find? Does not appear to make any sense.