Sponsored Content
Operating Systems AIX How do i delete files older than 15 days in AIX? Post 302408990 by ross.mather on Wednesday 31st of March 2010 02:50:10 AM
Old 03-31-2010
Consider making sure you only delete regular files:

Code:
find /path/to/files* -mtime +15 -type f -exec rm -f \{\} \;

This will leave any directory structures under the initial point intact.

You also have a wild card in the find path, if this is to be a script you may wish to reconsider that as it the fututre it may have unintended side effects.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

delete files older than 7 days

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. UNIX for Dummies Questions & Answers

How can I delete files older than 7 days?

I will like to write a script that delete all files that are older than 7 days in a directory and it's subdirectories. Can any one help me out witht the magic command or script? Thanks in advance, Odogboly98:confused: (3 Replies)
Discussion started by: odogbolu98
3 Replies

3. Shell Programming and Scripting

delete files and folders older than 3 days

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

4. UNIX for Dummies Questions & Answers

Delete files older than 30 days

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

5. Shell Programming and Scripting

Delete files older than certain days - Wrong !!!

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

6. 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

7. Solaris

Delete files older than 30 days

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

8. Shell Programming and Scripting

Delete files older than X days.

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. Shell Programming and Scripting

Delete 5 days older files from sftp

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 {} \;... (1 Reply)
Discussion started by: ATWC
1 Replies
Tree::Simple::Visitor::PathToRoot(3pm)			User Contributed Perl Documentation		    Tree::Simple::Visitor::PathToRoot(3pm)

NAME
Tree::Simple::Visitor::PathToRoot - A Visitor for finding the path back a Tree::Simple object's root SYNOPSIS
use Tree::Simple::Visitor::PathToRoot; # create an instance of our visitor my $visitor = Tree::Simple::Visitor::PathToRoot->new(); # pass the visitor to a Tree::Simple object $tree->accept($visitor); # now get the accumulated path as a string # with the '/' character as the delimiter print $visitor->getPathAsString("/"); # include the tree's trunk in your # output as well $visitor->includeTrunk(); # for more complex node objects, you can specify # a node filter which will be used to extract the # information desired from each node $visitor->setNodeFilter(sub { my ($t) = @_; return $t->getNodeValue()->description(); }); # you can also get the path back as an array my @path = $visitor->getPath(); DESCRIPTION
Given a Tree::Simple object, this Visitor will find the path back to the tree's root node. METHODS
new There are no arguments to the constructor the object will be in its default state. You can use the "includeTrunk" and "setNodeFilter" methods to customize its behavior. includeTrunk ($boolean) Based upon the value of $boolean, this will tell the visitor to collect the trunk of the tree as well. setNodeFilter ($filter_function) This method accepts a CODE reference as its $filter_function argument and throws an exception if it is not a code reference. This code reference is used to filter the tree nodes as they are collected. This can be used to customize output, or to gather specific information from a more complex tree node. The filter function should accept a single argument, which is the current Tree::Simple object. visit ($tree) This is the method that is used by Tree::Simple's "accept" method. It can also be used on its own, it requires the $tree argument to be a Tree::Simple object (or derived from a Tree::Simple object), and will throw and exception otherwise. getPath This will return the collected path as an array, or in scalar context, as an array reference. getPathAsString ($delimiter) This will return the collected path as a string with the path elements joined by a $delimiter. If no $delimiter is specified, the default (', ') will be used. BUGS
None that I am aware of. Of course, if you find a bug, let me know, and I will be sure to fix it. CODE COVERAGE
See the CODE COVERAGE section in Tree::Simple::VisitorFactory for more inforamtion. SEE ALSO
These Visitor classes are all subclasses of Tree::Simple::Visitor, which can be found in the Tree::Simple module, you should refer to that module for more information. AUTHOR
stevan little, <stevan@iinteractive.com> COPYRIGHT AND LICENSE
Copyright 2004, 2005 by Infinity Interactive, Inc. <http://www.iinteractive.com> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2005-07-14 Tree::Simple::Visitor::PathToRoot(3pm)
All times are GMT -4. The time now is 07:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy