![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help Help Help in recursion | murtaza | Shell Programming and Scripting | 6 | 03-29-2007 10:26 AM |
| allow recursion on dns server? | xnightcrawl | UNIX for Advanced & Expert Users | 1 | 03-29-2006 10:36 AM |
| recursion too deep | swamy455 | Shell Programming and Scripting | 3 | 07-18-2005 03:18 PM |
| recursion | gsjf | Shell Programming and Scripting | 1 | 08-26-2002 12:22 AM |
| remove files | Nisha | Shell Programming and Scripting | 7 | 06-26-2002 12:04 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to remove old files without recursion?
Hi folks,
I need to write a script which remove files with suffix *.dmp from a specific directory ,older than 30 days and not including recursive subdirectories. I.e: The following command remove recursive all *.dmp files older than 30 days: Code:
find $ORACLE_BASE -mtime +30 -type f -name "*.dmp" -exec rm {} \;
How to do it? Thanks in advance, Nir |
|
||||
|
If your find doesn't have that option, an example will hardly help?
Code:
find $ORACLE_BASE -maxdepth 1 -mtime +30 -type f -name "*.dmp" -exec rm {} \;
Code:
find $ORACLE_BASE -mtime +30 -type f -name "*.dmp" -print | grep -v '/.*/' | xargs -r rm The number of slashes obviously depends on the number of slashes in $ORACLE_BASE -- two would be correct for the current directory. (ORACLE_BASE=.) |
![]() |
| Bookmarks |
| Tags |
| mtime |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|