--- Begin Message ---
Subject: |
Not possible to list directories recursiv (-d switch ignores -R) |
Date: |
Wed, 17 Oct 2012 20:01:14 +0200 |
User-agent: |
KMail/4.9.2 (Linux/3.5.6-1-ARCH; KDE/4.9.2; x86_64; ; ) |
Documentation says the following:
-d, --directory :: list directory entries instead of contents, and do not
dereference symbolic links
and
-R, --recursive :: list subdirectories recursively
And this is what i get when i use ls -dR /
$ ls -dR /
/
I even tried
ls -d --recursiv -R -R -R -RRRRRRRRRRR /
/
The -R switch stand-alone works fine
Im using the coreutils 8.19 package from Archlinux
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#12664: Not possible to list directories recursiv (-d switch ignores -R) |
Date: |
Wed, 17 Oct 2012 13:44:12 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121009 Thunderbird/16.0 |
tag 12664 notabug
thanks
On 10/17/2012 12:01 PM, Vamp898 wrote:
> Documentation says the following:
>
> -d, --directory :: list directory entries instead of contents, and do not
> dereference symbolic links
>
> and
>
> -R, --recursive :: list subdirectories recursively
>
> And this is what i get when i use ls -dR /
>
> $ ls -dR /
> /
Thanks for the report. However, POSIX require -d to treat directories
as files rather than directories, and says that mixing -d and -R is
unspecified:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html
> -d
> Do not follow symbolic links named as operands unless the -H or -L
> options are specified. Do not treat directories differently than other types
> of files. The use of -d with -R produces unspecified results.
In GNU, we take this to mean that -d always overrides -R, because
recursion makes sense only if you treat a directory as a directory, but
-d says to treat it as a file instead.
If you need to mix recursion with listing of directories, consider using
find(1), as in:
find . -type d
or with specific ls options:
find . -type d -exec ls -ld {} +
As such, I'm closing this as not a bug; but you are free to still add
comments or questions to this conversation.
--
Eric Blake address@hidden +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
--- End Message ---