Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Removing files older than 7 days Post 302115057 by awk on Friday 20th of April 2007 12:14:04 PM
Old 04-20-2007
find ./ -type f -mtime +7 -exec rm -f {} \;

Warning, as coded, this will remove ALL files in the current directory and all subdirectories that were not either created or modified in the last 7 days.

Other coding will be necessary to restrict to only current directory.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

tar files older than 30 days

Hi there, I am trying to tar a number of files held in a specific folder. I am only interested in archiving files older than 30 days. Having read through the man entries and all available documentation I thought I'd cracked the coomand with tar -c -z -v -N 15/04/2004 -f /wfch.tar * This... (6 Replies)
Discussion started by: wfch
6 Replies

2. Shell Programming and Scripting

Deleting files older than 7 days

Hi Guys, I want to delete folder/files older than 7 days. Im using the command below. find /test/test1 -mtime +7 -print0 | xargs -0 rm -Rf /test/test1/* which works ok, but it deletes the test1 folder as well which i dont want. The test1 folder will have a list of sub-folders which in... (4 Replies)
Discussion started by: shezam
4 Replies

3. Shell Programming and Scripting

delete files more than 15 days older

i have to delete files which are older than 15 days or more except the ones in the directory Current and also *.sh files i have found the command for files 15 days or more older find . -type f -mtime +15 -exec ls -ltr {} \; but how to implement the logic to avoid directory Current and also... (3 Replies)
Discussion started by: ali560045
3 Replies

4. Shell Programming and Scripting

How to find files older than 30 days

Dear Friends, I have two queries. 1) I want to see the list of folders which were created 29 days ago. 2) I want to see the folders in which last created file is older than 29 days. Can it be done? Thank you in advance Anushree (4 Replies)
Discussion started by: anushree.a
4 Replies

5. UNIX Desktop Questions & Answers

Find files older than 10 days

What command arguments I can use in unix to list files older than 10 days in my current directory, but I don't want to list the hidden files. find . -type f -mtime +15 -print will work but, it is listing all the hidden files., which I don't want. (4 Replies)
Discussion started by: Pouchie1
4 Replies

6. Shell Programming and Scripting

List the files which are older than 7 days

Hi Frnds, I have to list the files which are older than 7 days in the given directory. it should consider only the files and should not show subdirectories. Thanks, Raja (3 Replies)
Discussion started by: smr_rashmy
3 Replies

7. UNIX for Advanced & Expert Users

removing files older than n days

Hi, on AIX 6.1, is there any commande line to remove the files older than n days in a directory ? Thanks. (2 Replies)
Discussion started by: big123456
2 Replies

8. UNIX for Advanced & Expert Users

find files older than 30 days old

Hello, I have a script which finds files in a directory that are older than 30 days and remove them. The problem is that these files are too many and when i run this command: find * -mtime +30 | xargs rm I run this command inside the directory and it returns the error: /usr/bin/find:... (8 Replies)
Discussion started by: omonoiatis9
8 Replies

9. UNIX for Dummies Questions & Answers

Files older than 50 days

Hi All, OS :- HP-UX wm5qa B.11.23 U ia64 1119805695 unlimited-user license I need to search files older than 50 days. I've used following command in order to search desired files, I also discoverd, it's showing today's files as well. Do you have any clue with this ? wmqa1> find .... (4 Replies)
Discussion started by: alok.behria
4 Replies
rt-clean-sessions(8)					     Request Tracker Reference					      rt-clean-sessions(8)

NAME
rt-clean-sessions - clean old and duplicate RT sessions SYNOPSIS
rt-clean-sessions [--debug] [--older <NUM>[H|D|M|Y]] rt-clean-sessions rt-clean-sessions --debug rt-clean-sessions --older 10D rt-clean-sessions --debug --older 1M rt-clean-sessions --older 10D --skip-user DESCRIPTION
Script cleans RT sessions from DB or dir with sessions data. Leaves in DB only one session per RT user and sessions that aren't older than specified(see options). Script is safe because data in the sessions is temporary and can be deleted. OPTIONS
older Date interval in the "<NUM>[<unit>]" format. Default unit is D(ays), H(our), M(onth) and Y(ear) are also supported. For example: "rt-clean-sessions --older 1M" would delete all sessions that are older than 1 month. skip-user By default only one session per user left in the DB, so users that have sessions on multiple computers or in different browsers will be logged out. Use this option to avoid this. debug Turn on debug output. NOTES
Functionality similar to this is implemented in html/Elements/SetupSessionCookie ; however, that does not guarantee that a session will be removed from disk and database soon after the timeout expires. This script, if run from a cron job, will ensure that the timed out sessions are actually removed from disk; the Mason component just ensures that the old sessions are not reusable before the cron job gets to them. perl v5.14.2 2013-05-22 rt-clean-sessions(8)
All times are GMT -4. The time now is 06:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy