Cron job delete files older than 30 days
Am I right that I can leave 'usr' as it is, or do I need to replace that with the name of the user I'm logged in as which is root? Any reasons why you wouldn't use -delete? HvdW HvdW 11 3 3 bronze badges. Welcome on the ServerFault! I suggest to give more details, what is your config doing and how.
Thanks for your answer. A explanation and some details would be very helpful. HvdW Can you please explain the advantages of using -delete over rm? Found many answers on the internet, but none of them satisfactory. Also is there any downside to using delete? An example would do — Dawson Smith. Sign up or log in Sign up using Google. Ex:- Delete all files and folders from a specified path older than Jan Save my name, email, and website in this browser for the next time I comment.
Facebook Twitter Instagram. TecAdmin Home Ubuntu Some times parent directory modification date can be older than child directories. In that case recursive delete can remove child directory as well. Related Posts. Handling filenames with spaces in Linux 3 Mins Read. Anoop on September 27, am. Antonio on October 21, am. Walter on January 4, pm. Graeme Graeme 32k 6 6 gold badges 79 79 silver badges bronze badges.
Of course then the bang line for a script would have to be! Does rm -f not handle errors silently, thereby handling any possible race condition with -exec? Show 1 more comment. You would be much better off using tmpwatch tmpwatch recursively removes files which haven't been accessed for a given time. Barry Chapman Barry Chapman 3 3 silver badges 4 4 bronze badges. Sign up or log in Sign up using Google.
Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. What does the " xargs" mean? Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name.
Email Required, but never shown. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually.
0コメント