I'm new to shell scripting...
I've a situation like to find *.tar files under all subdirectories in "/home/abcd" and i used the below,
find /opt/lhapp ! -name "temp" | more
the above works fine.. Now don't need search few direcotries like "/home/abcd/aaaa", "/home/abcd/bbbb", "/home/abcd/cccc". So i need to exclude these directories. How??? any ideas???
It works fine.. If i give only the directory.. for examaple here "abcd". But my situation is like "/abc/defh/abcd" means i just wanted to eliminate this complete path not all the abcd directory.
I tried giving the complete path but its not excluding ""/abc/defh/abcd" directory.
It work fine.. But it's not excluding when i use the entire path for example(/home/cccc) and it works when i give only the directory as cccc. I just wanted to exclude the entire directory path and I need xxxx to be searched when it is not in(/home/cccc). Below is code the used which was not excluding the /home/cccc.
But it still searching under(/home/cccc) where it should exclude but aaaa got completely excluded.
Thanks in advance!
Vasanth
---------- Post updated at 10:30 PM ---------- Previous update was at 10:03 PM ----------
Hi,
It work fine.. But it's not excluding when i use the entire path for example(/home/cccc) and it works when i give only the directory as cccc. I just wanted to exclude the entire directory path and I need xxxx to be searched when it is not in(/home/cccc). Below is code the used which was not excluding the /home/cccc.
I suppose that skipping, for example, /home/sysadmin/t/abcd/dddd/aaaa could be an issue for you, but your problem seems to be different, could you please clarify providing an example (files that should/shouldn't be included in the output)?
Hi Radoulov,
Exactly what you guessed below is right!
Thanks for your help Radoulov!
I used 2 separate find command for source and copybook :
/home/apps/**/source
where it always searches in the test source/copybook.Sorry for the unwanted thought of mine
Anyways below is my requirement. Hope you will understand. Thanks again.
My requirement :
my test environment path example: /home/apps/xx/source where xx is the test region.
my production path example : /home/apps/source
Now i need to find like :
find /home/apps -name "1234"
The above will search for the 1234 under /home/apps.. here i need to skip the /home/apps/source which was production and i need to search on all test region. If i skip "source" directory in the below code it will skip both production and test regions source directory well where my requirement is it should not skip the test environment.