List specific files from directories


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting List specific files from directories
# 1  
Old 02-16-2005
List specific files from directories

Hello,
I would like to list the files from all directories that has been modified more than 1 month ago, and whose name is like '*risk*log'.

I think a script like this should work :

Code:
ls -R | find -name '*risk*.log' -mtime 30 -type f

But it tells me "no file found" though I can see some.

Could you tell me what mistake I made ?

Thanks.
# 2  
Old 02-16-2005
Hi Filippo,

Try the following syntax:
find . -name \*risk*.log -mtime -30 -exec ls -ltr {} \;

Regaeds,
Nir
# 3  
Old 02-16-2005
Thanks Nir !

Quote:
Originally Posted by nir_s
Hi Filippo,

Try the following syntax:
find . -name \*risk*.log -mtime -30 -exec ls -ltr {} \;

Regaeds,
Nir
# 4  
Old 02-16-2005
If you want more than a month ago you need to use -mtime +30
# 5  
Old 02-17-2005
Quote:
Originally Posted by dangral
If you want more than a month ago you need to use -mtime +30
Thanks dangral Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Move several files into specific directories with a loop

Hello, I'm a first time poster looking for help in scripting a task in my daily routine. I am new in unix but i am attracted to its use as a mac user. Bear with me... I have several files (20) that I manually drag via the mouse into several named directories over a network. I've used rsync... (14 Replies)
Discussion started by: SonnyClark
14 Replies

2. Shell Programming and Scripting

Running program and output files in specific directories

I have been running a program mseed2sac using the following command cd IV find . -type f -exec /swadmin/mseed2sac '{}' \; The problem is that I end up with a lot of files in directory IV. Instead I would like to select the designator HHZ, create a directory IV.SAC and all the files output... (11 Replies)
Discussion started by: kristinu
11 Replies

3. Solaris

A way to list directories that contain specific files.

Hi everyone My issue is this, I need to list all the sub directories in a directory that contains files that have the extension *.log, *.dat and *.out . After reviewing the output i need to delete those directories i do not need. I am running Solaris 10 in a bash shell. I have a script that I... (2 Replies)
Discussion started by: jsabo40
2 Replies

4. UNIX for Advanced & Expert Users

Appending a files contents to the end of a specific file name in several directories

Here is my dir structure: /tmp/dave/myappend.txt /tmp/dave/dir1/test.txt /tmp/dave/dir2/test.txt /tmp/dave/dir3/test.txt /tmp/dave/dir4/test.txt I want to append the contents of myappend.txt to the end of each file with the name "test.txt" in all dirs in /tmp/dave/ I have tried this:... (2 Replies)
Discussion started by: bigd213
2 Replies

5. Shell Programming and Scripting

Find specific files only in current directory...not sub directories AIX

Hi, I have to find specific files only in the current directory...not in the sub directories. But when I use Find command ... it searches all the files in the current directory as well as in the subdirectories. I am using AIX-UNIX machine.Please help.. I am using the below command. And i am... (2 Replies)
Discussion started by: aakishore
2 Replies

6. Shell Programming and Scripting

How to list all the files, directories and sub-directories in the current path except one directory?

Can anyone come up with a unix command that lists all the files, directories and sub-directories in the current directory except a folder called log.? Thank you in advance. (7 Replies)
Discussion started by: Manjunath B
7 Replies

7. Shell Programming and Scripting

Recursively move directories along with files/specific files

I would like to transfer all files ending with .log from /tmp and to /tmp/archive (using find ) The directory structure looks like :- /tmp a.log b.log c.log /abcd d.log e.log When I tried the following command , it movies all the log files... (8 Replies)
Discussion started by: frintocf
8 Replies

8. UNIX for Dummies Questions & Answers

List directories and sub directories recursively excluding files

Hi, Please help me, how to get all the direcotries, its sub directories and its sub directories recursively, need to exclude all the files in the process. I wanted to disply using a unix command all the directories recursively excluding files. I tried 'ls -FR' but that display files as... (3 Replies)
Discussion started by: pointers
3 Replies

9. Shell Programming and Scripting

grep'ing for specific directories, and using the output to move files

Hello, this is probably another really simple tasks for most of you gurus, however I am trying to make a script which takes an input, greps a specific file for that input, prints back to screen the results (which are directory names) and then be able to use the directory names to move files.... (1 Reply)
Discussion started by: JayC89
1 Replies
Login or Register to Ask a Question