Solved

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

Posted on 2008-10-06
3
868 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 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

Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

Question has a verified solution.

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

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

624 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