Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > "bare" format for ls listing
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 28th April 01:11
External User
 
Posts: 1
Default "bare" format for ls listing



Hi *,

I think they had a DOS command to just print out a directory listing in
'bare' format "dir /B" or something like that.

While using ls in Unix/Linux. You get something like:

// - - - - - - - - - - - - - - - - - - - - - - - - - -
sh-3.00# pwd
/home/knoppix
sh-3.00# ls -l
total 0
drwxr-xr-x 2 knoppix knoppix 160 Sep 19 23:43 Desktop
drwxr-xr-x 2 knoppix knoppix 40 Apr 19 2004 tmp
sh-3.00# ls -Rl
..:
total 0
drwxr-xr-x 2 knoppix knoppix 160 Sep 19 23:43 Desktop
drwxr-xr-x 2 knoppix knoppix 40 Apr 19 2004 tmp

../Desktop:
total 24
-rw-r--r-- 1 knoppix knoppix 1014 Sep 19 23:50 CD-ROM [cdrom1]
-rw-r--r-- 1 knoppix knoppix 1000 Sep 19 23:50 CD-ROM [cdrom]
-rw-r--r-- 1 knoppix knoppix 686 Mar 31 2003 Floppy
-rw-r--r-- 2 knoppix knoppix 189 Sep 19 23:42 KNOPPIX.desktop
-rw-r--r-- 1 knoppix knoppix 4801 Sep 19 23:43 trash.desktop

../tmp:
total 0
sh-3.00#
// - - - - - - - - - - - - - - - - - - - - - - - - - -

How could you get something like this:

sh-3.00# ls (?)
drwxr-xr-x 2 knoppix knoppix 160 Sep 19 23:43 /home/knoppix/Desktop
drwxr-xr-x 2 knoppix knoppix 40 Apr 19 2004 /home/knoppix/tmp
-rw-r--r-- 1 knoppix knoppix 1014 Sep 19 23:50 /home/knoppix/Desktop/CD-ROM
[cdrom1]
-rw-r--r-- 1 knoppix knoppix 1000 Sep 19 23:50 /home/knoppix/Desktop/CD-ROM
[cdrom]
-rw-r--r-- 1 knoppix knoppix 686 Mar 31 2003 /home/knoppix/Desktop/Floppy
-rw-r--r-- 2 knoppix knoppix 189 Sep 19
23:42 /home/knoppix/Desktop/KNOPPIX.desktop
-rw-r--r-- 1 knoppix knoppix 4801 Sep 19
23:43 /home/knoppix/Desktop/trash.desktop

or just

/home/knoppix/Desktop
/home/knoppix/tmp
/home/knoppix/Desktop/CD-ROM [cdrom1]
/home/knoppix/Desktop/CD-ROM [cdrom]
/home/knoppix/Desktop/Floppy
/home/knoppix/Desktop/KNOPPIX.desktop
/home/knoppix/Desktop/trash.desktop

Notice that you would get the fully qualified file names.

I need to get to all reachable files for a given user (all existing files
for root, e.g.) in a file and then process this file (with the
saved'/redirected output) in stead of going through the directory hierarchy
and get this info for each file.

All this info is in the fs right? What is the most efficiet way to get if
from there?

Thanks
  Reply With Quote


  sponsored links


2 28th April 01:11
dan weiner
External User
 
Posts: 1
Default "bare" format for ls listing



Have you tried using "find" instead of ls? It's much more configurable,
and always gives paths as well as filenames.
  Reply With Quote
3 28th April 01:11
gbussi
External User
 
Posts: 1
Default "bare" format for ls listing


Hello,

I think you should try the 'find' command.
Use "find ." to find all files in the current dir.
Use "find . -exec cat {} \;" to cat them all, and so on.
You can exec any command in this way.

Bye!

Giovanni
  Reply With Quote
4 28th April 01:11
nan li
External User
 
Posts: 1
Default "bare" format for ls listing


In bash
1. Try 'find $PWD'
2. Try 'find . -user root -exec ls -l {} \;'
If you really want to have a file in between, try '
TMPFILE=/tmp/tmp1; find . -user nan > $TMPFILE ; (while read t ; do ls
-l $t; done ) < $TMPFILE'

Nan
  Reply With Quote
5 28th April 01:11
nan li
External User
 
Posts: 1
Default "bare" format for ls listing


In bash,

1. try 'find $PWD'
2. try 'find . -user root -exec ls {} \;'
  Reply With Quote
6 28th April 01:11
gbussi
External User
 
Posts: 1
Default "bare" format for ls listing


Hi,
you should try "find ." to have the list, or "find . -exec cat {} \;"
to cat them all.
Bye
Giovanni
  Reply With Quote
7 28th April 01:12
nobody
External User
 
Posts: 1
Default "bare" format for ls listing


what about:

du -a <directory> |awk '{ print $2 }'
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666