in reply to Re^2: file search
in thread file search

it is not giving me the files in the sub directory. How do i do that?

As per toolic's reply, use opendir/readdir.

I need to avoid cyclic links, but didn't get the idea how to check the cyclic link?

Have a look at readlink.

Also i need to find a way without recursion?

Any other restrictions? Can we use computers? Recursion is the only by far the most sensible approach when dealing with an arbitrary depth of sub-directories.

Update: Slightly toned down the recursion encomium!

Cheers,

JohnGG

Replies are listed 'Best First'.
Re^4: file search
by wfsp (Abbot) on Mar 07, 2011 at 17:42 UTC
    Can we use computers?
    johngg++
    Recursion is the only...
    One way might be push all the dirs onto a @stack as you find them and shift them off one at a time to process them. Then you can convince yourself you're not using recursion which I find easy to do. :-)
      thanks for the reply john. I know, it is quite easy to do with recursion and File:FInd, but as i said, it was an assignment might be they are checking my capability. what do yo say, if we do a grep in the directory and stack the list and then taking the directory and processing the file.

        If "they" are checking your capability, why are you trying to be dishonest about it by asking others to do your work for you?