Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-10-06
3
Medium Priority
?
870 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 252 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 248 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

730 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