options in FIND utility


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting options in FIND utility
# 1  
Old 07-14-2006
options in FIND utility

hi folks,

I want to select all files older than 13 days from a specified directory
for that i used

find /home/amar -name '*.*' -mtime 13

but it gives me all the files from subdirectories also, I dont want that

I want files only from /home/amar and not from /home/amar/abc/..

which option is suitable here -depth,-mindepth,-prune ?
how to use it ???
# 2  
Old 07-14-2006
-maxdepth 1
# 3  
Old 07-14-2006
thanx Hitori,

but i am having problem that in the statement how to use it ??


find /home/amar -maxdepth 1 -name '*.*' -mtime 13

find /home/amar -name '*.*' -mtime 13 -maxdepth 1

find -maxdepth 1 /home/amar -name '*.*' -mtime 13

are not working
# 4  
Old 07-14-2006
May be you forget to add '+' to the -mtime's argument option.
this works fine for me (with another directory Smilie):

$ find /home/amar -maxdepth 1 -name '*.*' -mtime +13
# 5  
Old 07-14-2006
It says find: bad option -maxdepth

Last edited by preethgideon; 07-14-2006 at 07:35 AM..
# 6  
Old 07-14-2006
Then you out of luck. What version of find do you use?
# 7  
Old 07-14-2006
$ find --version
GNU find version 4.2.27
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION SELINUX
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

behavior of find utility's -mtime -7 primary

Can I ask a question not related to original question. I have this below command running on a directory which contains thousands of files. This command runs for 5 minutes. Any files received in folder1 during the execution of command is getting moved, even though that file is just received and it's... (6 Replies)
Discussion started by: Super123
6 Replies

2. AIX

Help to find isutf8 utility for AIX 6.1

Hello everyone, I need to validate the file format for the UTF-8 standard. I know that "isutf8"utility is a part of "moreutils" pkg, I was able to find this package for the Linux but my environment in the AIX 6.1. I would be greatly appreciate your suggestion to my search. I am not familiar with... (5 Replies)
Discussion started by: Nadya Chipova
5 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. Solaris

parse utility options

how can I make options to my script as: myscript.sh -s abc -f filename -v value if there is an easy way and efficient to do that issue ? plz advice. (2 Replies)
Discussion started by: Ahmed waheed
2 Replies

5. Shell Programming and Scripting

Question on Find Utility

Hi Guys, Do you know how can I find files with modificatioin time less than 30 MINUTES using the find utility? Or if u have any other mechanism to find it using script, I'll appreciate it. Thanks! (5 Replies)
Discussion started by: marlonus999
5 Replies

6. UNIX for Dummies Questions & Answers

can't find my NEDIT utility after shell change

Hello, My System Admin. just switched me from KSH to BASH and something happened to my "nedit" utility! Does anyone know how to reactivate nedit by anychance? Thanks very much! BobK (2 Replies)
Discussion started by: bobk544
2 Replies

7. Shell Programming and Scripting

Compound command with 'find' utility?

I'm trying to write a script using the 'find' command and it's -exec option to run a compound command against the files found. Example: find . -name "*.conf" -exec cat {} | grep "#" > /tmp/comments.list \; Of course the above doesn't work. So I experimented for a bit to see if there was... (6 Replies)
Discussion started by: deckard
6 Replies

8. Programming

Threaded 'find' utility

I need to modify my version of find in unix and get it to create and use two POSIX threads to carry out concurrent finding operations. How do i get about doing this>? If anyone could help me it would be much appreciated. Thanx Mariuca (1 Reply)
Discussion started by: mariuca
1 Replies
Login or Register to Ask a Question