Delete files older than 1 hour unix




















So it's completely safe no matter what characters the filenames contain. AdminBee Greenonline 1, 4 4 gold badges 14 14 silver badges 21 21 bronze badges. Greg Greg 1. This will not work with files with spaces in them. 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 Making Agile work for data science. Stack Gives Back Featured on Meta.

New post summary designs on greatest hits now, everywhere else eventually. This breaks find 's recursive operation on subdirs. If you're trying to just match files, use -type f instead — nickf.

Or use touch -t to create such a file. If you're on Linux, -mmin is available, if not then date and other commands are also feeble in comparison. To rm files and directories older than file. To rm files and directories newer than file. To place file. Credit: xoftl , rovr , nickf. Show 1 more comment. Try looking at the man page. GavinCattell GavinCattell 3, 19 19 silver badges 22 22 bronze badges.

For SunOS 5. The midnight boundary between days has no effect on the hour calculation. Darren Rajeev Rumale Rajeev Rumale 11 1 1 bronze badge. Fortunately, other old tools can manage this, albeit in a more unwieldy way. Malcolm Boekhoff Malcolm Boekhoff 10 10 silver badges 7 7 bronze badges.

Was hopeful because this old UNIX doesn't have -mmin, but, sadly this is of no help as this old UNIX also does not like fractional values for mtime: find: argument to -mtime must be an integer in the range to — kbulgrien. Eragonz91 Eragonz91 1 1 silver badge 12 12 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. Is there some variation of find. Thanks as always for your help. Regards, Dave : 2 Replies. Finding files older than 2 hours. I want to write a sh script that will find files older than 2 hours and tar them. I've had a look at the find man page but can't see how to do it by hours. Help please. Thanx 1 Reply. RedHat Commands. OpenSolaris Commands. Linux Commands. SunOS Commands. FreeBSD Commands. Full Man Repository. Advanced Search. Contact Us.

Forum Rules. Mark Forums Read. Thread Tools. View Public Profile for homeboy. Find all posts by homeboy. View Public Profile for thegeek. Find all posts by thegeek.



0コメント

  • 1000 / 1000