Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2008-10-06
3
Medium Priority
?
871 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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .

885 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