find command in terminal -- listing files twice

Straitsfan

Registered
find command in terminal -- listing files twice
I noticed the other day that after i used the find command to search for some files, the computer listed them twice -- first with just the names of the files (meaning ./(then the individual file names), then with the directory name, followed by the file names (directory name/file name). I was already in the desired directory, and I don't think this has ever happened before. Can someone tell me why it does this and how to fix it? Is there something wrong?


Here's the command I'm using:

find . -iname "*(text to search for)*" -type f

and, if I use find from my home directory (that is, not in the desired directory, it lists ./(directory name)/(directory name)/file names. This is really wierd. Is it supposed to do this?
 
To me it lists the files only once, so there is something wrong. You might like to try

find . -iname "*text*" -type f -print0 | xargs -0 ls -l

It lists each file with lots of information in columns. You should check the second column. It should be 1 (each file contains has only one name).
 
Uh -- guess what?

I noticed that I placed a copy of the subdirectory from my flash drive into the subdirectory, which meant I had two copies of the same file.

A simple srm and they were gone.

I. feel. like. such. an. idiot.
 
Back
Top