FIND: Combining -size & -prune


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FIND: Combining -size & -prune
# 1  
Old 09-24-2012
FIND: Combining -size & -prune

I am having an issue adding the -size test to my find command.

I am trying to find all files smaller than 250mb, that are not in .snapsnot or man directories.

What i started with

Code:
find . -xdev -type d \( -name man -o -name .snapshot \) -prune -o -type f

What I have tried..unsuccessfully
Code:
find . -xdev -size -262144000c -type d \( -name man -o -name .snapshot \) -prune -o -type f

find . -xdev \( -type d \( -name man -o -name .snapshot \) -o -size +262144000c \) -prune -o -type f

I know i am just placing something in the wrong place. Can you help me out here?
# 2  
Old 09-24-2012
Try:
Code:
find . -xdev -type d \( -name man -o -name .snapshot \) -prune , -type f -size -262144000c

--
Bye
# 3  
Old 09-24-2012
What's your system? GNU find may have some options more convenient than -prune...
# 4  
Old 09-24-2012
Quote:
Originally Posted by Corona688
What's your system? GNU find may have some options more convenient than -prune...
HP & SOL

---------- Post updated at 12:23 PM ---------- Previous update was at 12:20 PM ----------

Quote:
Originally Posted by Lem
Try:
Code:
find . -xdev -type d \( -name man -o -name .snapshot \) -prune , -type f -size -262144000c

--
Bye
What does the "," do?

Dont remember seeing that in the man page.
# 5  
Old 09-24-2012
Quote:
Originally Posted by nitrobass24
What i started with

Code:
find . -xdev -type d \( -name man -o -name .snapshot \) -prune -o -type f

All you need to do is append -size -262144000c.

Regards,
Alister

---------- Post updated at 01:36 PM ---------- Previous update was at 01:34 PM ----------

Quote:
Originally Posted by nitrobass24
What does the "," do?

Dont remember seeing that in the man page.
It's a GNU extension. It evaluates the expression to its left but discards its value (much like the C comman operator is used solely for side-effects).

Regards,
Alister
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using prune with find

Hi, I have two files under two separate directories as in: find . -name test.sh ./test.sh ./abc/test.sh I want my find to only look for the file test.sh that is under the current directory and not one under /abc How do I use prune to achieve this? I am on AIX (3 Replies)
Discussion started by: swasid
3 Replies

2. Solaris

Usage of -prune and -name in find

I am into cd /home/work/amey/history-*/ Under amey I have directories history, history-1, history-2 and under history-2 I have got 2 files 3 and 2. When I run the find command I get the below o/p. find /home/work/amey/history-*/. -name . -o -prune -type f /home/work/amey/history-1/.... (1 Reply)
Discussion started by: ameyrk
1 Replies

3. Shell Programming and Scripting

find: -prune and -name options

I am trying to find all .rhosts files on some unix systems. I tried just -name ".rhosts" but we have a lot of really large NFS and MVFS systems that I do not want to crawl and I am having a hard time excluding them. I also need to scan more than just /root /home and /users, so I really need to scan... (1 Reply)
Discussion started by: nitrobass24
1 Replies

4. UNIX for Dummies Questions & Answers

Find with Prune not working

Hi I am trying to list all files in every subdirectory from a given location. However, I realise that 1 folder will have files that I am not interested in. This is using a .csh file to execute I have tried different scripts but to no avail. My current incarnation is below. Would someone be... (4 Replies)
Discussion started by: wonderbison
4 Replies

5. UNIX for Dummies Questions & Answers

Find prune Trash

How do I run a find without is looking in ./Trash gregg@gregg-desktop:/media/Audio$ find . -type f ! -name '*.jpg' -size 1M -print |head find: `./.Trash-1000/expunged/2781324553/mp3-to-m4b-batch': Input/output error find:... (0 Replies)
Discussion started by: glev2005
0 Replies

6. Shell Programming and Scripting

Find + prune + mtime

Hi, i try to catch all files in a dir ,without going down in subdir , which don't have file extension and older than 10 days for example: my dir : drwxr-xr-x 7 notes01 notes 4096 Mar 8 14:11 . drwxr-xr-x 116 root system 4096 Mar 9 11:17 .. -rw-r----- 1 notes01... (4 Replies)
Discussion started by: Nicol
4 Replies

7. UNIX for Dummies Questions & Answers

Problems with find & -size

Hi I am trying to find files over a size given by the user. this is what I have so far echo "Enter a pathname to check (example = /home/jsk1gcc/testwork): " read input echo "Enter a the size (examples = 100k, 10M, 1G): " read size find $input -size +$size echo echo "Hit the Enter... (2 Replies)
Discussion started by: AngelFlesh
2 Replies

8. Shell Programming and Scripting

How to use -path and -prune with find

OK, I'm trying search and destroy tabs again. This time I'm having trouble excluding certain directories from my search. Here is what I have tried and it is not ignoring the top level build directory: find . -path ./build -prune -name \*.java -o -print | xargs grep -i ' ' I don't... (6 Replies)
Discussion started by: siegfried
6 Replies

9. Shell Programming and Scripting

find with prune option

Hi, I want to list files only from the current dir and its child dir (not from child's child dir). i have the following files, ./ABC/1.log ./ABC/2.log ./ABC/ABC1/A.log ./ABC/ABC1/B.log ./ABC/ABC1/XYZ/A1.log ./ABC/ABC1/XYZ/A2.log Here i want to list only the log file from current... (1 Reply)
Discussion started by: apsprabhu
1 Replies

10. UNIX for Dummies Questions & Answers

Using prune with find command

Hi, I am using a find command like below in my script: find /outfiles -type f -name cat -o -name vi -o -name grep 2>/dev/null Which will search for files like "cat" , "vi" or "grep" in the "/outfiles" and subdirectories. I want to ignore a particular subdirectory from the search. I... (4 Replies)
Discussion started by: deepakgang
4 Replies
Login or Register to Ask a Question