02-26-2002
Hello !
The command is :
find /your_directory -mtime +7 -exec rm -f {} \;
Witt
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
can anyone tell me how I would write a script in ksh on AIX that will delete files in a directory older than 7 days? (1 Reply)
Discussion started by: lesstjm
1 Replies
2. Shell Programming and Scripting
find /basedirectory -type f -mtime +3 >> /tmp/tempfile
find /basedirectory -type d -mtime +3 >> /tmp/tempfile
mailx -s "List of removed files and folders" myemail@domain.com < /tmp/te
mpfile
rm /tmp/tempfile
find /basedirectory -type f -mtime +3 -exec rm {} \;
find /basedirectory -type d... (7 Replies)
Discussion started by: melanie_pfefer
7 Replies
3. UNIX for Dummies Questions & Answers
This is driving me crazy. How can I delete files in a specifc directory that are over 30 days old? Thanks in advance. (3 Replies)
Discussion started by: tlphillips
3 Replies
4. Shell Programming and Scripting
Guys,
I had raised a question about deleting files older than today in a specific directory and i got this as an answer
find ${ARCH_DEST}/*.gz -mtime +0 -exec rm -f {} \;
What happens when there aren't files that meet this criteria ? Can it delete any other directories ? I had a shocking... (22 Replies)
Discussion started by: kamathg
22 Replies
5. Shell Programming and Scripting
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
6. Solaris
Hi all,
I want to delete log files with extension .log which are older than 30
days. How to delete those files?
Operating system -- Sun solaris 10
Your input is highly appreciated.
Thanks in advance.
Regards,
Williams (2 Replies)
Discussion started by: William1482
2 Replies
7. AIX
Hi i have tried searching and googling, but cant quite get there
I need to delete all files in a directory that are older than 15 days
here is what i have tried
find /path/to/files* -mtime +15 -exec del {} \;the first section works
find /path/to/files* -mtime +15but the del command dosent... (4 Replies)
Discussion started by: bluesteel
4 Replies
8. Shell Programming and Scripting
Hi All,
I am using below code to delete files older than 2 days. In case if there are no files, I should log an error saying no files to delete.
Please let me know, How I can achive this.
find /path/*.xml -mtime +2
Thanks and Regards
Nagaraja. (3 Replies)
Discussion started by: Nagaraja Akkiva
3 Replies
9. UNIX for Advanced & Expert Users
As one of our requirement was to connect to remote Linux server through SFTP connection and delete some files which are older than 7 days.
I used the below piece of code for that,
SFTP_CONNECTION=`sftp user_id@host ...
cd DESIRED_DIR;
find /path/to/files* -mtime +5 -exec rm -rf {} \;
bye... (2 Replies)
Discussion started by: ATWC
2 Replies
LEARN ABOUT CENTOS
cyr_expire
CYR_EXPIRE(8) System Manager's Manual CYR_EXPIRE(8)
*
NAME
cyr_expire - expire messages and duplicate delivery database entries
SYNOPSIS
cyr_expire [ -C config-file ] [ -D delete-days ] -E expire-duration [ -X expunge-days ] [ -p mailbox-prefix ] [ -v ]
DESCRIPTION
Cyr_expire is used to expire messages and duplicate delivery database entries. Cyr_expire also cleanses mailboxes of partially expunged
messages (when using the "delayed" expunge mode). The expiration of messages is controlled by the /vendor/cmu/cyrus-imapd/expire mailbox
annotation which specifies the age (in days) of messages in the given mailbox that should be deleted. Any duplicate delivery database
entries which correspond to the mailbox are also deleted at the same frequency.
The value of the /vendor/cmu/cyrus-imapd/expire annotation is inherited by all children of the given mailbox, so an entire mailbox tree can
be expired by seting a single annotation on the root of that tree. If a mailbox does not have a /vendor/cmu/cyrus-imapd/expire annotation
set on it (or does not inherit one), then no messages are expired from the mailbox.
Cyr_expire reads its configuration options out of the imapd.conf(5) file unless specified otherwise by -C.
OPTIONS
-C config-file
Read configuration options from config-file.
-D delete-duration
Remove previously deleted mailboxes older than delete-duration (when using the "delayed" delete mode). The value can be a floating
point number, and may have a suffix to specify the unit of time. If no suffix, the value is number of days. Valid suffixes are d
(days), h (hours), m (minutes) and s (seconds).
-E expire-duration
Prune the duplicate database of entries older than expire-duration. This value is only used for entries which do not have a corre-
sponding /vendor/cmu/cyrus-imapd/expire mailbox annotation. Format is the same as delete-duration.
-X expunge-duration
Expunge previously deleted messages older than expunge-duration (when using the "delayed" expunge mode). Format is the same as
delete-duration.
-x Do not expunge messages even if using delayed expunge mode (reduces the IO hit considerably, allowing you to run cyr_expire fre-
quently to clean up the duplicate database without overloading your server)
-p mailbox-prefix
Only find mailboxes starting with this prefix. e.g. "user.justgotspammedlots"
-v Enable verbose output.
-a Skip the annotation lookup, so all /vendor/cmu/cyrus-imapd/expire annotations are ignored entirely. It behaves as if they were not
set, so only expire-days is considered for all mailboxes.
FILES
/etc/imapd.conf
SEE ALSO
imapd.conf(5), cyrus-master(8)
CMU
Project Cyrus CYR_EXPIRE(8)