The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
searching content of files in the current and sub directories tiger99 Shell Programming and Scripting 4 01-23-2008 03:11 AM
searching files through all subdirectories beneath the current directory milagros Shell Programming and Scripting 5 05-15-2007 04:00 PM
ls latest 4 days or specify days of files in the directory happyv Shell Programming and Scripting 3 01-22-2007 07:16 AM
How to zip a modified file 15 days before but not scanning my sub directory files skrish70 Shell Programming and Scripting 1 10-10-2005 03:41 PM
Removing files automatically from a directory after 30 days. justinb_155 Shell Programming and Scripting 7 06-24-2005 02:07 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-31-2003
cxredd4 cxredd4 is offline
Registered User
  
 

Join Date: Oct 2003
Posts: 5
Searching for files over 30 days old in current directory

May be a simple question for experts here....


I need to get the list of files older than 30 days in the current folder. I tried "find", but it searches recursively in all the sub directories.

Can I restrict the recursive search and extract the files only from current directory ?
  #2 (permalink)  
Old 10-31-2003
maverick maverick is offline
Registered User
  
 

Join Date: Oct 2003
Location: mumbai,india
Posts: 20
to find file in DIR
use
find $DIR -type f -atime +30 -print
hope it will suffice
  #3 (permalink)  
Old 10-31-2003
oombera's Avatar
oombera oombera is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
See if this works:

find . -mtime +30 \( ! -name . -prune \)
  #4 (permalink)  
Old 10-31-2003
cxredd4 cxredd4 is offline
Registered User
  
 

Join Date: Oct 2003
Posts: 5
Both the above scripts are digging down the sub directories. Any other altrenative ?
  #5 (permalink)  
Old 10-31-2003
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,407
Try....
Code:
find $PWD -type f -mtime +30 -print|grep -Ev "$PWD/.*/"
  #6 (permalink)  
Old 03-29-2006
legato legato is offline
Registered User
  
 

Join Date: Nov 2004
Location: singapore
Posts: 40
hi for this command
find $PWD -type f -mtime +30 -print|grep -Ev "$PWD/.*/"

can i know the usage for E in grep -Ev
this produce error when i use it.
grep: illegal option -- E
Usage: grep -hblcnsviw pattern file . . .
  #7 (permalink)  
Old 03-29-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
You must have a very old grep. -E is required by posix. It allows extended regular expressions. You might have an egrep program that can do extended regular expressions.
Closed Thread

Bookmarks

Tags
mtime, regex, regular expressions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0