A puzzle! Crontab and mkdir and files, oh my!

Ralf Mardorf kde.lists at yahoo.com
Thu Apr 24 13:19:51 UTC 2025


On Thu, 2025-04-24 at 23:03 +1000, Karl Auer wrote:
> Happy to hear corrections or better explanations.

As I already mentioned in another reply, my guess is, that it
it probably should read

0 1 * * * username find /home/ubuntu/data -type d -name '*_temp*' -exec rm -r {} \+ > /home/ubuntu/data/log/adfd_cleanup.log 2>&1

"-exec rm -r {} \+" does remove the found directories.
               "\"  like this it would remove each found directory
                    separately

                    rm -r 1_temp1
                    rm -r 2_temp2
                    rm -r n_tempn

               "\+" like this it does remove all directories by running
                    rm just one time

                    rm -r 1_temp1 2_temp2 n_tempn

                    then there's no need for ">>", just a ">" is
                    required, with the advantage that each time the
                    crone job runs, the log file is overwritten.





More information about the ubuntu-users mailing list