Quote:
|
Originally Posted by avadhani
hi,
Above command list all files , but all output is passed as one argument to command.
|
Try this.
Code:
find /parent/dir/to/search -name '*.[c|cpp|h]' -exec ls -l {} \;
Quote:
|
Originally Posted by avadhani
and also output has full path of file. I want only filename and comand should be executed on each filename.
Thanks
|
Yes the output will have filename. That is because, you are searching for files which are inside the /parent/dir/to/search directory. The find returns the path to that file with reference to /parent/dir/to/search.
If you need only the filename on each of the find result, use basename for each result that is thrown.
Code:
find /parent/dir/to/search -name '*.[c|cpp|h]' -exec basename {} \;
Vino