LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   find command displays unexpected results (https://www.linuxquestions.org/questions/linux-newbie-8/find-command-displays-unexpected-results-661125/)

helptonewbie 08-07-2008 06:21 AM

find command displays unexpected results
 
Hi All,
I was trying to find all symlinks under a specific folder to do this i used:-
find /bar/foo/ -type l

This works fine on the most part and produced expected results appart from one of the results returned was very odd...output something like...
/bar/foo/bar/link
/bar/foo/foo/link
/nothing/to/do/with/bar/foo/link
/bar/foo/why/link

Get the meaning?? everything was returning from inside /bar/foo as i would expect apart from this one line which appears to have come from somewhere completely different and i've not been able to even find the location yet as there is no such place as:-
/nothing/to/do/.....

As in not possible to go "cd /nothing/to/do/......"

What is happening in this output???

Regards

matthewg42 08-07-2008 06:27 AM

If possible, please copy paste the actual command and the actual results. As you describe it, it looks weird, but maybe you are missing something that a fresh pair of eyes can spot, given the original data.

sleepyhomme 08-07-2008 06:28 AM

The default behavior of find is not following the symbolic link...so if i am not misunderstand your text, how about use -L option of find to force find utility to follow the symbolic link
Code:

find  -L /some/path/for/searching -type l

helptonewbie 08-07-2008 04:04 PM

Weird looks like my reply to this was lost from earlier...hmmm

anyway, the problem was found it was to do with a directory that had been named for some reason accedently ?

don't know why naming a dir ? would cause the problem and i'd be happy for someone to tell me if they know???

jailbait 08-07-2008 04:31 PM

? can be used as a wild card in a file or directory name. So maybe the directory name ? came about by somebody trying to use a wild card name inappropriately.

Similarly maybe the find command uses some other command to follow the link and the subcommand trips over the ? by treating it as a wildcard.

--------------------
Steve Stites

helptonewbie 08-12-2008 02:25 AM

Hi There, i think that sounds about right...it certainly looked like it was not working correctly even when trying to traverse back out of the folder to the top of the tree (so to speak). That it wasn't possible to do cd ../../

It would fail with some weird error....anyway sorted now thanks for the info


All times are GMT -5. The time now is 05:24 AM.