Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-10-2005
Registered User
 
Join Date: Dec 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ls -R command but need complete path name on each line

Can anyone help me with the following:
I need to traverse subdirectories to create a list of files with the pathname. For example, here’s what I get with a simple ls –alR command:

/MAIN/data/30007390 dte2>>ls -alR

.:

total 2

drwxrwx--- 4 ecfadmin staff 96 Oct 24 18:35 .

drwxrwx--- 37 ecfadmin staff 1024 Oct 24 18:35 ..

drwxrwx--- 2 ecfadmin staff 96 Oct 24 18:35 GroupB

drwxrwx--- 2 ecfadmin staff 96 Oct 24 18:35 GroupA



./GroupB:

total 8

drwxrwx--- 2 ecfadmin staff 96 Oct 24 18:35 .

drwxrwx--- 4 ecfadmin staff 96 Oct 24 18:35 ..

-rwxrwx--- 1 ecfadmin staff 1968 Oct 24 18:35 02050506.GZ

-rwxrwx--- 1 ecfadmin staff 1976 Oct 24 18:35 02050720.GZ



./GroupA:

total 20

drwxrwx--- 2 ecfadmin staff 96 Oct 24 18:35 .

drwxrwx--- 4 ecfadmin staff 96 Oct 24 18:35 ..

-rwxrwx--- 1 ecfadmin staff 9453 Oct 24 18:35 05050602.GZ



What I would like to get back is something with the full path name and file name:



/MAIN/data/30007390/GroupB/02050720.GZ

/MAIN/data/30007390/GroupB/02050506.GZ

/MAIN/data/30007390/GroupA/05050602.GZ

*Permissions, primary and secondary group names, dates times and sizes are not needed but don’t have to be excluded.

I’m looking for something pretty straight forward, I could write a little shell to handle it but was hoping for something a little more elegant. (I was hoping there was a version (or option) of “ls” out there that might do it).

Any help would be appreciated.
Sponsored Links
    #2  
Old 12-10-2005
Just Ice's Avatar
Lights on, brain off.
 
Join Date: Mar 2005
Location: in front of my computer
Posts: 671
Thanks: 0
Thanked 7 Times in 7 Posts
try "find" instead ... see "man find" ...

find . -type f -print
Sponsored Links
    #3  
Old 12-12-2005
Registered User
 
Join Date: Dec 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
That was exactly what I was looking for. It works great. Thanks very much!!!
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Show complete command on command line when we use 'ps' mk1216 Solaris 11 03-15-2012 08:46 AM
Can grep command return word instead of complete line dashing201 UNIX for Dummies Questions & Answers 11 12-28-2010 04:58 AM
how to find complete path of a file in unix yahoo! UNIX for Advanced & Expert Users 1 07-25-2008 01:49 AM
Using the Esc key to complete command line typing jxh461 UNIX for Dummies Questions & Answers 1 06-05-2007 06:04 PM
displaying the path in the command line ocelot Shell Programming and Scripting 2 10-10-2006 02:58 PM



All times are GMT -4. The time now is 09:48 AM.