command to list all the files and with the path also

Scott R. Godin scott.g at mhg2.com
Wed Jul 5 16:25:30 UTC 2006


On Wed, 5 Jul 2006 08:11:30 -0700 (PDT), Al Sparks wrote:

> --- Kaushal Shriyan <kaushalshriyan at gmail.com> wrote:
> 
> > On 7/5/06, Joachim Backes <joachim.backes at rhrk.uni-kl.de> wrote:
> > Hi Joachim Backes
> > 
> > I get
> > 
> > [root at bdc root]# find | xargs ls -l
> > xargs: unmatched single quote
> > [root at bdc root]#
> 
> "xargs" is problematic when used with "find".  Basically xargs is
> taking raw output and placing it at the end of the command line you're
> piping to.  So if you have filenames that have characters which need
> to be escaped, the shell doesn't handle it too well.
> 
> Also, if you're going to do a recursive list using "find", "xargs",
> and "ls" you're much better off using
>    find | xargs ls -ld

perhaps better would be 
    find -exec ls -ld {} \;

Also useful to know is how to limit this to directories only, where you
would do something like
    find -type d -exec ls -ld {} \;

or if you just want the paths and not the extra info, remove the -l 
    find -type d -exec ls -d {} \;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20060705/4ead01bb/attachment-0002.bin 


More information about the users mailing list