# broken pipe?

**URL:** <https://community.unix.com/t/broken-pipe/142570>\
**Category:** UNIX for Dummies Questions & Answers\
**Created:** [May 11, 2002, 9:52pm UTC](https://community.unix.com/t/broken-pipe/142570 "2002-05-11T21:52:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gusla](https://community.unix.com/letter_avatar/gusla/32/5_5575768a8748004e209b776fc1b2916d.png) [@gusla](https://community.unix.com/u/gusla)\
**Post date:** [May 11, 2002, 9:52pm UTC](https://community.unix.com/t/broken-pipe/142570/1 "2002-05-11T21:52:41Z")

</div>

Hi there,

I try to use:  
\> find \* | ls  
but it just gave me one level of ' ls '. and it said:

\> find \* | ls  
dir1 dir2 f1 f2 f3  
Broken Pipe  
\>

what is broken pipe?  
how can i fix it?

thks

Gusla

---

<div class="post-metadata">

**Author:** ![LivinFree](https://community.unix.com/user_avatar/community.unix.com/livinfree/32/20_2.png) [@LivinFree](https://community.unix.com/u/LivinFree)\
**Post date:** [May 12, 2002, 12:00am UTC](https://community.unix.com/t/broken-pipe/142570/2 "2002-05-12T00:00:32Z")

</div>

Use a big wrench! 😛

Seriously, though, you shouldn't have to pipe find to ls.  
Also, you should use "find .", since it will begin in ".", the current directory.

Check the man page for find. If you wanted a long listing, for example, you could use either of these commands:

find . -exec ls -l {} \;  
find . | xargs ls -l

You can also narrow it down to type files, or just directories:  
find . -type f -exec ls -l {} \;  
find . -type d -exec ls -l {} \;

Hope this helps.

---

<div class="post-metadata">

**Author:** ![gusla](https://community.unix.com/letter_avatar/gusla/32/5_5575768a8748004e209b776fc1b2916d.png) [@gusla](https://community.unix.com/u/gusla)\
**Post date:** [May 12, 2002, 12:36am UTC](https://community.unix.com/t/broken-pipe/142570/3 "2002-05-12T00:36:35Z")

</div>

thks Freelive.

my initial purpose is wanted to pipe the files to a perl program.

see, say my perl program is getfile.pl (taking file names as argumemnts)

```nohighlight
# getfile.pl
#!/usr/bin/perl -w
 while ($ARGV = shift)
 {
        print "\nprocessing $ARGV...";
        if (-d $ARGV)
        {
           print "\n$ARGV is a DIR\n";
         }
 }

```

if i use:  
\> getfile.pl f1 f2 dir1 dir2  
to execute the perl file, it's working.

However, if i use:  
\> ls | getfile.pl OR \>find \* | getfile.pl  
it's not working. It wouldn't recoglise the input argument (@ARGV is empty)

also  
\>getfile.pl \< f1 f2 dir1 dir2

it only recognise f2, dir1, dir2. The first argument f1 is missing. (ie. @ARGV only contains f2, dir1 and dir2)

WHY?

appreciate as usual

Gusla  
:rolleyes:

added code tags for readability --oombera

---

<div class="post-metadata">

**Author:** ![LivinFree](https://community.unix.com/user_avatar/community.unix.com/livinfree/32/20_2.png) [@LivinFree](https://community.unix.com/u/LivinFree)\
**Post date:** [May 12, 2002, 5:05am UTC](https://community.unix.com/t/broken-pipe/142570/4 "2002-05-12T05:05:22Z")

</div>

Sorry, I'm not a perl kinda guy...

Hopefully someone else can help here...
