Operating System - HP-UX
1753502 Members
5099 Online
108794 Solutions
New Discussion юеВ

ls command ... getting full path.

 
SOLVED
Go to solution
Manuales
Super Advisor

ls command ... getting full path.

Hi ..
how can i do to get this information when i
use the command ls:

i am located in
pwd
/data/users/files/

the normal out is:
ls -lat:
-rw-r--r-- 1 508 dba 4274 Dec 15 2009 testfile.txt

i wat to get the out as follows:
-rw-r--r-- 1 508 dba 4274 Dec 15 2009 /data/users/files/testfile.txt

if you see, i want to get the out with the full path where the file name is.

how can i get that?
thanks.
6 REPLIES 6
Jose Mosquera
Honored Contributor
Solution

Re: ls command ... getting full path.

Hi,

What about of:
#find /data/users/files/ -type f -exec ls -l {} \;

Rgds.
Jose Mosquera
Honored Contributor

Re: ls command ... getting full path.

Hi again,

If you need list a specific filename:
#find /data/users/files/ -name testfile.txt -type f -exec ls -l {} \;

For detailed info about "find" and "ls" commands:
#man find
#man ls

Rgds.
Manuales
Super Advisor

Re: ls command ... getting full path.

THANKS ... BUT
if i do this:

$ find /data/users/files/ -name * -type f -exec ls -l {} \;
find: missing conjunction
$ find /data/users/files/ -name *.* -type f -exec ls -l {} \;
find: missing conjunction
$


it is not working .. i want to display all the files with full path under the directory /data/users/file , how can i do that?
Steven Schweda
Honored Contributor

Re: ls command ... getting full path.

> $ find /data/users/files/ -name * [...]

> $ find /data/users/files/ -name *.* [...]

You might try quoting the wildcards:

find /data/users/files/ -name '*' [...]
find /data/users/files/ -name '*.*' [...]

But, if you want all the files, then why use
_any_ "-name" option?


To see what "find" saw:

echo *
echo *.*
Bill Hassell
Honored Contributor

Re: ls command ... getting full path.

> ls command ... getting full path.

This will provide what you want:

ls -d $PWD/*


Bill Hassell, sysadmin
Manuales
Super Advisor

Re: ls command ... getting full path.

Thanks all, it worked !!!!