Solved

How do I show the full path for directories in Unix?

Posted on 2008-10-06
3
861 Views
Last Modified: 2013-12-26
I need to list the full paths to subdirectories within a given directory in Unix.  Here's what I'm using to find the directories:


cd /usr/test
find * -type d

This give me the following:
yrcw
yrcw/includes
yrcw/pdf

How can I modify the 'find' command to also show the full path such as the following:
/usr/testyrcw
/usr/testyrcw/includes
/usr/testyrcw/pdf

Thanks, and look forward to some help!

0
Comment
Question by:aggunia
3 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 63 total points
ID: 22651131
Hello aggunia,

find . -type d | while read name
do
   dirname=`echo $name | sed 's/^\.//'`
   echo `pwd`$dirname
done

Regards,

sunnycoder
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 62 total points
ID: 22651370
try

dir=/usr/test
cd $dir
find * -type d | while read d
do
   echo $dir/$d
done
0
 

Author Closing Comment

by:aggunia
ID: 31503462
Both of these solutions worked, so split up the points.  Thanks a lot!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
repeatSeparator  java  challenge 13 56
maxBlock challenge 30 101
conditional code and condition difference 9 65
only14 challenge 19 64
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now