![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| 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 12:11 AM |
| searching files through all subdirectories beneath the current directory | milagros | Shell Programming and Scripting | 5 | 05-15-2007 01:00 PM |
| ls latest 4 days or specify days of files in the directory | happyv | Shell Programming and Scripting | 3 | 01-22-2007 04: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 12:41 PM |
| Removing files automatically from a directory after 30 days. | justinb_155 | Shell Programming and Scripting | 7 | 06-24-2005 11:07 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 ? |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
to find file in DIR
use find $DIR -type f -atime +30 -print hope it will suffice |
|
#3
|
||||
|
||||
|
See if this works:
find . -mtime +30 \( ! -name . -prune \) |
|
#4
|
|||
|
|||
|
Both the above scripts are digging down the sub directories. Any other altrenative ?
|
|
#5
|
||||
|
||||
|
Try....
Code:
find $PWD -type f -mtime +30 -print|grep -Ev "$PWD/.*/" |
|
#6
|
|||
|
|||
|
Thanks a lot Ygor, this one is working.
Again thanks everybody. |
|
#7
|
||||
|
||||
|
Hmm... the -prune option is supposed to be what prevents going into subdirectories!
|
||||
| Google The UNIX and Linux Forums |
| Tags |
| mtime, regex, regular expressions |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|