07-16-2007
how to stop to current directory using find
Hello,
I just want to ask the following use of find command:
1. how can I find files only to the current directory?
2. how can I find files to directories and all subdiretories (are this include soft links?) but will not go to other mountpoints that is under that mountpoint.
Im combining mountstop and prune for question 1 and 2, but it is taking time. Are the results accurate?
find . -mountstop -prune -type f -print
but it looks like its not working as it cannot retrieve files and subdirectories either.
why do I need to put "! -name ." in order for it to work? as it exclude the . file (current directory)
find . ! -name . -mountstop -prune -type f -print
How could I avoid looping/finding files on other mountpoints? except using the mountstop...
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am trying to use the find command to find files in the current directory that meet a certain date criteria.
find . -type -f -mtime +2
However, the above also checks the directories below.
I tried -prune, but that seems to ignore this directory completely.
I read about using -path w/... (5 Replies)
Discussion started by: jliebling
5 Replies
2. UNIX for Dummies Questions & Answers
Using Solaris 8, I've forgotten how to exclude the current directory in the find results.
find . -type d ! -name "*.CAP"
I want every directory that does not match the *.CAP pattern, except the current directory. (2 Replies)
Discussion started by: dangral
2 Replies
3. Shell Programming and Scripting
i want to compile a list of files in all sub directories but exclude the current directory.
the closest i could get was to search 'only' the current directory, which is the opposite of what i wanted.
find . ! -name . -prune (7 Replies)
Discussion started by: mjays
7 Replies
4. Shell Programming and Scripting
Hi,
Has anyone tried to restrict Solaris 10 unix find on a large directory structure based on time to stop running after finding the first occurrence of a matching query. Basically I'm trying to build up a usage map of user workspaces based on file modification (week/month/3 months/year etc) and... (3 Replies)
Discussion started by: jm0221
3 Replies
5. UNIX for Dummies Questions & Answers
Hello,
How to find the list of 5 largest(size wise) file in current directory?i tried using
ls -l | sort -t " " -r +5 -6 -n | head -5
but this is not giving correct output as ls -l command gives 1 extra line of output that is how many total files are there!so by running the above... (4 Replies)
Discussion started by: salman4u
4 Replies
6. Shell Programming and Scripting
Hello all,
I am having a hard type in figuring out how to only gather certain files in the current directory without exploring its subdirectories.
I tried:
find . -name "*.ksh" -prune
this also returns ksh files from lower subdirectories.
I also tried
find . -ls -name "*.ksh"
This also... (8 Replies)
Discussion started by: gio001
8 Replies
7. UNIX for Dummies Questions & Answers
i have this find command on my script as:
for i in `find $vdir -name "$vfile" -mtime +$pday`
the problem with this code is that the sub-directories are included on the search. how do i restrict the search to confine only on the current directory and ignore the sub-directories. please advise.... (7 Replies)
Discussion started by: wtolentino
7 Replies
8. Shell Programming and Scripting
Hi,
I have to find 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 tried to use maxdepth..but it is not working in AIX. (2 Replies)
Discussion started by: vsachan
2 Replies
9. UNIX for Dummies Questions & Answers
Hi All,
I am trying to delete file (with a mtime older than 2 days) from the current directory ONLY using:
find . -daystart -maxdepth 1 -mtime 2 -exec rm {} \;
but this doesn't seem to work it is still find files in subdirectories which I don't want to delete.
Please can anyone offer... (2 Replies)
Discussion started by: daveu7
2 Replies
10. Shell Programming and Scripting
hello, all
I have googled internet, read the man page of Find, searched this forum, but still could not figure out how.
My current directory is:
little@wenwen:~$ pwd
/home/little
little@wenwen:~$
I want to use find command to list the files in my current directory, how should i write... (3 Replies)
Discussion started by: littlewenwen
3 Replies
prune(1) General Commands Manual prune(1)
NAME
prune - Prune directed graphs
SYNOPSIS
prune [ -n node ] [ -N attrspec ] [ -v ] [ -(h|?) ] [ files ... ]
DESCRIPTION
prune reads directed graphs in the same format used by dot(1) and removes subgraphs rooted at nodes specified on the command line via
options. These nodes themselves will not be removed, but can be given attributes so that they can be easily located by a graph stream edi-
tor such as gvpr(1). prune correctly handles cycles, loops and multi-edges.
Both options can appear multiple times on the command line. All subgraphs rooted at the respective nodes given will then be processed. If a
node does not exist, prune will skip it and print a warning message to stderr. If multiple attributes are given, they will be applied to
all nodes that have been processed. prune writes the result to the stdout.
OPTIONS
-n name
Specifies name of node to prune.
-N attrspec
Specifies attribute that will be set (or changed if it exists) for any pruned node. attrspec is a string of the form attr=value.
-v Verbose output.
-h -? Prints the usage and exits.
EXAMPLES
An input graph test.gv of the form
digraph DG {
A -> B;
A -> C;
B -> D;
B -> E;
}
, processed by the command
prune -n B test.gv
would produce the following output (the actual code might be formatted in a slightly different way).
digraph DG {
A -> B;
A -> C;
}
Another input graph test.gv of the form
digraph DG {
A -> B;
A -> C;
B -> D;
B -> E;
C -> E;
}
(note the additional edge from C to E ), processed by the command
prune -n B -N color=red test.gv
results in
digraph DG {
B [color=red];
A -> B;
A -> C;
C -> E;
}
Node E has not been removed since its second parent C is not being pruned.
EXIT STATUS
prune returns 0 on successful completion. It returns 1 if an error occurs.
SEE ALSO
dot(1), gvpr(1)
AUTHOR
Marcus Harnisch <marcus.harnisch@gmx.net>
prune(1)