Delete files unix older than date


















I'm new to shell scripts, can anyone help? I want to delete scripts in a folder from the current date back to 10 days. The scripts looks like:. Just spicing up the shell script above to delete older files but with logging and calculation of elapsed time. Note : to test the code, just use -print instead of -print -delete. But do check your path carefully though.

Additionally check file times with 'stat filename'. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?

Collectives on Stack Overflow. Learn more. Delete files older than 10 days using shell script in Unix [duplicate] Ask Question. Asked 9 years, 1 month ago. Active 2 years, 3 months ago. Deleting specfic files older than N days. Deleting files older than 7 days. Im using the command below. The test1 folder will have a list of sub-folders which in Deleting Files Older than 24 hours. Hi, I am using Solaris Box, I need to delete file cookies.

RedHat Commands. OpenSolaris Commands. Linux Commands. SunOS Commands. FreeBSD Commands. Full Man Repository. Advanced Search. Contact Us. Forum Rules. Mark Forums Read. You can use a while loop instead which should take care of files with spaces. Neeraj Mhatre Neeraj Mhatre 1. The OP asked "I want to delete all the files older than 15 days", which your answer doesn't provide. They also did not ask for a restriction to php files. If that is your blogspot page, please indicate ownership explicitly, instead of the generic "below link", otherwise you become suspect of simply spamming your site.

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. Podcast Helping communities build their own LTE networks. Podcast Making Agile work for data science. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually.

Dave on October 15, am. JR on October 31, am. Ex:- Delete all files and folders from a specified path older than Jan Reply. Lakshmi on October 18, am. How to find and delete files older than 90 days in linux? Bachsau on September 27, pm. Lokesh on September 19, am. Rahul on August 17, am. Hi Adhir, Tutorial has been updated. Tobias Heel on April 6, pm. I get the same error.



0コメント

  • 1000 / 1000