Hello, I am using ksh93 (/usr/dt/bin/dtksh) on Solaris and am stuck when trying to use find with the -prune option.
I need to search a directory (supplied in a variable) for files matching a certain pattern, but ignore any sub-directories.
I have tried:
which produces no output. If I cd to that directory and issue this command:
it works as expected since it is working on a list of filenames.
Why doesn't it work when using a full path? I suspect it is being omitted by the -type d -prune option since I am using a full path? If so, how else to do it?
Oh and the sub-directories could change so I can't exclude them specifically in the find command.
Thanks for your consideration,
Gary
Last edited by gary_w; 01-03-2012 at 04:52 PM..
Reason: added more info
Hi All,
I am trying to find files in a directory and don't want to search in the sub directories and using the command
find . \( ! -name . -prune \) -mtime +1 -name '*.log'
and is working fine.
But when I am trying with absolute path then is not working like
find /home/subodh \( ! -name... (1 Reply)
I know one of the more seasoned veterans probably opened this thread looking for their chance to refer me to the site's search feature and let me tell you.
I'VE LOOKED!!!! And I didn't find anything helpful...
So, I've got a windows background and I'm fond of its search feature which comes... (6 Replies)
i want to find only the file t4 in directory t3. i am in dir t . the tree is as follows.
if i give,
find .
o/p is
.
./t4
./t1
./t1/t2
./t1/t2/t3
./t1/t2/t3/t4
./t1/t2/t4
./t1/t4
directories are like t/t1/t2/t3 and each directory has file t4.
my question is , i want to find file... (0 Replies)
Hi , Kindly help me out .:)
i want to find only the file t4 in directory t3. i am in dir t . the tree is as follows.
if i give,
find .
o/p is
.
./t4
./t1
./t1/t2
./t1/t2/t3
./t1/t2/t3/t4
./t1/t2/t4
./t1/t4
directories are like t/t1/t2/t3 and each directory has file t4.
my... (7 Replies)
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)
Hi
I have a directory say mydir and inside it there are many files and subdirectories and also a directory called lost+found owned by root user
I want to print all files directories and subdirectorres from my directory using find command except lost+found
If i do
find . \( -name... (3 Replies)
To find all the files in your home directory that have been edited in some way since the last tar file, use this command:
find . -newer backup.tar.gz
Is anyone familiar with an older solution?
looking to identify files older then 15mins across several directories.
thanks,
manny (2 Replies)
Hi,
I am trying to find some files in a directory and then remove/list them if they are 30 days old. I also have 2 directories in that directory which I need to skip. Can someone please tell me what is the correct syntax?
find /developer/. -name "lost+found" "projects" -prune -o -type f... (2 Replies)
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)
I need to delete all files from the working directory and its sub directories using the find command, for that I am using -prune option but some how I am having a syntax issue.
I have tried the below, please help me correct the syntax
find . -name \* -type f -exec rm -f {} \; >> Works but... (4 Replies)
Discussion started by: rosebud123
4 Replies
LEARN ABOUT SUSE
prune
prune(1) General Commands Manual prune(1)NAME
prune - Prune directed graphs
SYNOPSIS
prune [ -n node ] [ -N attrspec ] [ 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.
EXAMPLES
An input graph test.dot of the form
digraph DG {
A -> B;
A -> C;
B -> D;
B -> E;
}
, processed by the command
prune -n B test.dot
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.dot 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.dot
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)