Maybe you just want to use `find`? Something like: find \ /LVM/MONITORAMENTO/CARROS/CARRO-381*/$DATA*/*/* \ /LVM/MONITORAMENTO/CARROS/CARRO-380*/$DATA*/*/* \ ... \ -maxdepth 1 ! -type d -exec chown root:root -v {} \;
On Fri, May 27, 2022 at 8:51 AM Maxsuel Marcelino <maxz...@gmail.com> wrote: > chown needs and a new option: > > An option that allows you to change only the contents of directories > and not directories and subdirectories. > > After the end of the day I need "user 1" to be able to read and add > files, but NOT delete after 5pm. note: that the contents of some > folders cannot be deleted; however the directory can receive new > files. > > For that I created the following script: > > ############################### script ########################### > > ###Actual structure of folders### --> > /LVM/MONITORAMENTO/CARROS/CARRO-11897/2022/MAIO/DIA > 27/Data/00001610.ub1 > > ###variable### > DATA=`date +/%Y/%^B/DIA ` > > ###commands### > chown root:root -v /LVM/MONITORAMENTO/CARROS/CARRO-381*/$DATA*/*/* > chown root:root -v /LVM/MONITORAMENTO/CARROS/CARRO-380*/$DATA*/*/* > chown root:root -v /LVM/MONITORAMENTO/CARROS/CARRO-379*/$DATA*/*/* > chown root:root -v /LVM/MONITORAMENTO/CARROS/CARRO-378*/$DATA*/*/* > chown root:root -v /LVM/MONITORAMENTO/CARROS/CARRO-377*/$DATA*/*/* > chown root:root -v /LVM/MONITORAMENTO/CARROS/CARRO-376*/$DATA*/*/* > chown root:root -v /LVM/MONITORAMENTO/CARROS/CARRO-11899*/$DATA*/*/* > chown root:root -v /LVM/MONITORAMENTO/CARROS/CARRO-11898*/$DATA*/*/* > chown root:root -v /LVM/MONITORAMENTO/CARROS/CARRO-11897*/$DATA*/*/* > > ############################## end of script ######################### > > Everything would be simplified if [chwon] had an (option) that ignores > directories and sub-directories, reaching only the files. > > Example: The command line would be reduced to just one line. Ex: > chown root:root -v -(new option) /LVM/MONITORAMENTO/CARROS/CARRO-* > > Observation: > (new option) = contents of directories (files) only > > > Maxsuel Marcelino > Brasil > maxz...@gmail.com > >