[Solved] Assistance with find command please


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers [Solved] Assistance with find command please
# 1  
Old 10-24-2011
Question [Solved] Assistance with find command please

Trying to locate files less than xx days old, throughout all directories/subdirectories, but excluding certain types of directories and files.

The directories I want to search all contain the same characteristic (dbdef, pldef, ghdef, etc), and there are subdirectories within that I need to exclude
(all called 'sub'), so my command went something like this:

Code:
find ./*def/ -type d \( -name sub \) -prune -o -type f -mtime -365 | xargs -i ls -l {}

This works, however, I would also like to exclude certain types of files (*.xml and *.dmp), but I cannot work out how to exclude them. I have tried various
methods, but none have worked.

Any help appreciated.

Thanks in advance.
# 2  
Old 10-24-2011
Adding '!' -name '*.xml' '!' -name '*.dmp' should do.
# 3  
Old 10-25-2011
Thanks, that worked Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Assistance with my Find command to identify last part of a file name and report the name found

Hello Forum, We have two bootstraps of Chef in our environment which are identified by colour: /var/chef/cache/cookbooks/bootstrap_cookbooks_version_green and /var/chef/cache/cookbooks/bootstrap_cookbooks_version_red I'm attempting to identify which version is installed based on the name... (11 Replies)
Discussion started by: greavette
11 Replies

2. UNIX for Beginners Questions & Answers

Assistance with my one line command to find all inactive kernels

Hello Forum, I'm using the following command to find all inactive kernels installed on my RHEL server: $ rpm -qa | grep '^kernel-' |grep -vE `uname -r` but the result is in two lines: kernel-3.10.0-1062.1.1.el7.x86_64 kernel-3.10.0-1062.el7.x86_64 Is there a one line command I can... (3 Replies)
Discussion started by: greavette
3 Replies

3. UNIX for Dummies Questions & Answers

Sed/command assistance

Hello all, I need some help and education creating a script. Basically I have a file with a list of numbers.. 2125554444 2124445555 I need to put them into a format that looks like this.... UQ-V8.1,2125554444,hdaudio UQ-V8.1,2124445555,hdaudio Any help would be greatly... (6 Replies)
Discussion started by: jay11789
6 Replies

4. AIX

[Solved] Find command hangs my terminal session

Hello every one. I know little to nothing about AIX. Recently I have been assigned to an AIX project. For some reason or another the find command is hanging the server. Well it does not hand server per say, it just freezes my terminal session. after running find, I waited up to 40 min and... (3 Replies)
Discussion started by: busi386
3 Replies

5. Shell Programming and Scripting

[Solved] Find command is not working

Hello Friends, I have a problem about a little script, when i run the following two lines one by one on CLI then they work well: /usr/bin/mkdir `perl -e 'use POSIX qw(strftime); print strftime "%Y-%m-%d",localtime(time() - 30*24*60*60);'` find . -type f -name "fuseesb.log.*" -mtime 30... (5 Replies)
Discussion started by: EAGL€
5 Replies

6. Shell Programming and Scripting

[Solved] Grep within find command

Platform: AIX 6.1/ksh Question1. I want to grep for the string "CUSTOM_PKMS" in all the files in server except those files with extensions .dbf , .ctl and .dmp I started running the following command but it is taking too long because there are lots of .dbf , .ctl and .dmp files in this... (6 Replies)
Discussion started by: John K
6 Replies

7. UNIX Desktop Questions & Answers

[SOLVED] find command match pattern

Hello, I would like to ask you, how to match directory names. I need to find only directories, which are created only from numbers and doesn't include any letters. I used command find $AC_WORKDIR/work_archive/test/$dirs_years -maxdepth 1 -name \\* -print If I have dirs like 12... (3 Replies)
Discussion started by: satin1321
3 Replies

8. UNIX for Dummies Questions & Answers

[Solved] weird in find -exec command

i feel weird with this 2 command find /tmp/*test* -user `whoami` -mtime +1 -type f -exec rm -f {}\; find /tmp/*test* -user `whoami` -mtime +1 -type f -exec ls -lrt {}\; the first one return correct which only delete those filename that consist *test* where second command it listed all the... (12 Replies)
Discussion started by: lsy
12 Replies

9. UNIX for Advanced & Expert Users

Assistance Needed With Find/Replace in Vi

Hello All I have always had a question about find and replace in Vi. As this uses Vi, sed, and RegEx I never knew how or where to post the question but I thought I would give it a shot here. Say I have a text file filled with the following: Sue, your IP address is 192.168.1.10 which is... (4 Replies)
Discussion started by: NoSalt
4 Replies

10. UNIX for Dummies Questions & Answers

Command assistance

Hi, We currently use the below basic scripts to output details that the business requires for our AIX and Sun servers. I have been asked to produce the same sort of script to be used for our NCR MP-RAS UNIX and OS/2 UNIX servers but am not formilar with these forms of Unix. Would greatly... (0 Replies)
Discussion started by: kmuir
0 Replies
Login or Register to Ask a Question