2

Can some one please tell me how to delete n minutes old files in Solaris? My find does not -mmin option.

2
  • does it have the -ctime option? Commented Apr 18, 2013 at 11:57
  • Yes. It includes ctime Commented Apr 18, 2013 at 11:58

2 Answers 2

2

If you can calculate the absolute time point (possible using some small script program) you can either use the -newermt YYYYMMDDThhmmss' option, or if that is not supportedtoucha file XY with that absolute date and user-newer XY(or! -newer XY`).

1
  • You can get a file reffile with an absolute time of 10 minutes (600 seconds) ago with e.g.: touch reffile -d "$(python -c 'import datetime; print (datetime.datetime.now() - datetime.timedelta(seconds=600)).replace(microsecond=0).isoformat()')" (assuming you have python installed) Commented Apr 18, 2013 at 14:43
1

This is exactly the reason for my posting previously which is pretty much about the tools that your sysadmin (or you) should always make sure is available on your Solaris host. (your problem is solved by GNU find). If such tools were available by default you wouldn't have had the question in the first place. :-)

You can read more about it here.

So simply use GNU find !!

3
  • Depending on the version of Solaris being used, gfind may be there. Check /opt/sfw/bin, /usr/sfw/bin, and /opt/gnu/bin. Commented May 2, 2013 at 14:05
  • 1
    True, but the "here" link in the above text was trying to teach the man to fish rather than to give him a fish. In other words fix the problem with (seemingly) missing GNU tools once and for all .. and not just for find. :-) Commented May 7, 2013 at 9:13
  • I applaud your effort, @nolan6000 Commented May 7, 2013 at 21:36

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.