Linux / UNIX Tech Support Forum
This is a discussion on Delete Files In Directory By Date within the Getting started tutorials forums, part of the Linux Getting Started category; Hey Friends, As as Systems Administrator for many servers, I always come across the need to delete files in a ...
|
|||||||
| Getting started tutorials So much to read, so little time! If that is your problem, we have solution. Read our FAQ and tutorials to help you cut through the clutter of information overload. Only members of "contributors" group can post new tutorials. Other members can just reply to thread. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
| Sponsored Links | ||
|
|
|
||||
|
Nice, -delete option is a bit faster (only works with GNU find version)
Code:
find /this/is/the/directory/ -type f -ctime +180 -delete
__________________
Vivek Gite Linux Evangelist |
|
||||
|
Hey Thanks,
I am using this version of find on rhel4. Code:
[root@radio5 ~]# find --version GNU find version 4.1.20 [root@radio5 ~]# Code:
[root@radio5 split]# find /root/jason -type f -name "*.txt" -delete find: invalid predicate `-delete' [root@radio5 split]# As always, thank you for you support and opinion. Jaysunn |
|
||||
|
I think you got older version. You need GNU find version 4.2.xx or above, which is shipped with RHEL5 and other distro. From my personal RHEL 5.4 box find man page:
Quote:
Oh and there is also tmpwatch command which removes files which haven’t been accessed for a period of time. See man page for details.
__________________
Vivek Gite Linux Evangelist |
| The Following User Says Thank You to nixcraft For This Useful Post: | ||
jaysunn (09-11-2009)
| ||
![]() |
| Tags |
| find , find -delete , find and delete older files , gnu/find , tmpwatch |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shell date command for manipulation and formatting date | newbie4 | Shell scripting | 4 | 28-10-2008 07:33 PM |
| To delete files in Trash | Ramya | CentOS / RHEL / Fedora | 1 | 08-09-2008 08:59 AM |
| Find Unix Linux File / Directory by date And Then Copy / Move File | asim.mcp | CentOS / RHEL / Fedora | 1 | 10-08-2008 03:30 AM |
| Shell Delete Directory | chimu | Slackware | 2 | 31-05-2008 03:36 PM |
| delete directory linux | chiku | Linux software | 4 | 22-07-2006 06:56 PM |