[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Get directories names



David Jardine wrote:
On Tue, Nov 09, 2004 at 05:09:51PM -0500, Tong wrote:

Hi,
I used to use the following command/alias to get the names under the
current directory in RH:

ls -l <criteria> | grep ^d | cut -c57-

but in Debian, the position of the file name is not fixed.


It is for me, and the above command works perfectly.


It is?

pretzalz@Pretzalz:~/projects/test1$ mkdir subdir
pretzalz@Pretzalz:~/projects/test1$ ls -l | grep ^d | cut -c57-

pretzalz@Pretzalz:~/projects/test1$ ls -l
total 4
drwxr-xr-x  2 pretzalz pretzalz 4096 Nov  9 22:20 subdir
pretzalz@Pretzalz:~/projects/test1$ dd if=/dev/zero of=hole bs=1k count=10 seek=1M
10+0 records in
10+0 records out
10240 bytes transferred in 0.000647 seconds (15827849 bytes/sec)
pretzalz@Pretzalz:~/projects/test1$ ls -l | grep ^d | cut -c57-
subdir
pretzalz@Pretzalz:~/projects/test1$ ls -l
total 24
-rw-r--r--  1 pretzalz pretzalz 1073752064 Nov  9 22:23 hole
drwxr-xr-x  2 pretzalz pretzalz       4096 Nov  9 22:20 subdir

And I agree that find is the best solution.



Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: