I am trying to search for a Directory called "mont" under a directory path "/opt/app/var/dumps"
Although "mont" is in the very parent directory called "dumps" i.e "/opt/app/var/dumps/mont" and it can never be inside any Sub-Directory of "dumps"; my below find command which also checks for permissions on the directory "mont" however takes more than 2 hrs.
Is there a way we can only consider the directory structure in the search while excluding the files.
How can we quicker the search result ?
Last edited by mohtashims; 07-12-2015 at 06:19 AM..
No! How do you suppose find determines which files it finds in a file hierarchy search are directories as opposed to some other type of file? It reads all of the directory entries in each directory it finds and then uses stat() (or a similar system call) to determine the type of that file. The find utility has no way to magically ignore non-directory files before it determines whether or not that file is a directory.
However, if find does encounter any directory that is mode 600, it won't be able to examine any files in or under that directory.
If you know that the pathname to the directory you want to process is /opt/app/var/dumps/mont, why are you using find instead of something like:
?
No! How do you suppose find determines which files it finds in a file hierarchy search are directories as opposed to some other type of file? It reads all of the directory entries in each directory it finds and then uses stat() (or a similar system call) to determine the type of that file. The find utility has no way to magically ignore non-directory files before it determines whether or not that file is a directory.
However, if find does encounter any directory that is mode 600, it won't be able to examine any files in or under that directory.
If you know that the pathname to the directory you want to process is /opt/app/var/dumps/mont, why are you using find instead of something like:
?
The reason i am using find instead ls ls -ld is becoz along with making sure mont exists under dump folder i should be able to check permissions on mont folder
And if I use ls -ld for files that do not exist and for files that do exist, as in:
it clearly shows me that /opt/app/var/dumps/mont does not exist on my machine and clearly shows me that . does exist and shows me its mode. On the other hand, if I run the command:
I only know that there is no directory named pdf with mode 600 in the file hierarchy rooted in my current directory, while the command:
clearly shows me that there is a directory named pdf in my current directory and that it has mode 755.
And, all of the above commands (except the find command) take less than a second.
So, less than a second to get the exact information you want versus more than two hours to maybe get the information you want. Tell me again why:
is a bad choice here to find out if there is a file named /opt/app/var/dumps/mont and, if there is, what type of file it is and what mode it has???
Hi,
I have a lengthy script which i have trimmed down for a test case as below.
more run.sh
#!/bin/bash
paths="allpath.txt"
while IFS= read -r loc
do
echo "Working on $loc"
startdir=$loc
find "$startdir" -type f \( ! -name "*.log*" ! -name "*.class*" \) -print |
while read file
do... (8 Replies)
Hi,
Below is my find command
find /opt/app/websphere -name myfolder -perm -600 | wc -l
At time it even takes 20 mins to complete.
my OS is : SunOS mypc 5.10 Generic_150400-09 sun4v sparc SUNW,T5440 (10 Replies)
Hi,
I am running a ssh connection test in a script, how can I add a timeout to abolish the process if it takes too long?
ssh -i ~/.ssh/ssl_key useraccount@computer1
Thank you.
- j (1 Reply)
Dear experts
I have a 200MG text file in this format:
text \tab number
I try to sort using options -fd and it takes very long! is that normal or I can speed it up in some ways?
I dont want to split the file since this one is already splitted.
I use this command: sort -fd file >... (12 Replies)
Hello,
like the title says, how can i measure the time it takes to load a module in Linux, and how how can i measure the time it takes to load a statically compiled module.
/Best Regards Olle
---------- Post updated at 01:13 PM ---------- Previous update was at 11:54 AM ----------
For... (0 Replies)
I have a file called "library" with the following content
libnxrdbmgr.a
libnxrdbmgr.so
libnxtk.a
libnxtk.so
libora0d_nsc_osi.so
I am trying to locate if these libraries are on my machine or not. find command runs for about few seconds and hangs after this.
Can someone please help me and... (3 Replies)
Hello,
I have a C program that takes anywhere from 5 to 100 arguments and I'd like to run it from a script that makes sure it doesnt take too long to execute. If the C program takes more than 5 seconds to execute, i would like the shell script to kill it and return a short message to the user. ... (3 Replies)
After my previous thread, I think I found out what causes the long delays.
I run this program on several Linux computers, and the sometimes (after the file with the arrays becomes big) the fwrite takes between 100 ms to 900 ms.
This is very bad for me, as I want a timer to halt each 30 ms.... ... (5 Replies)
Hello,
I create a file touch 1201093003 fichcomp
and inside a repertory (which hava a lot of files) I want to list all files created before this file :
find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long
but i make a filter all... (1 Reply)
Hi I am trying to find out the best way to find out how long a command takes to run in miliseconds ..
Is there such a way of doing this in Unix ?
Thanks (3 Replies)