public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
From: Flemming Greve Skovengaard <dsl58893@vip.cybercity.dk>
To: linux-newbie <linux-newbie@vger.kernel.org>
Cc: karthikv@Alum.Dartmouth.ORG
Subject: Re: finding directories within a particular directory
Date: Wed, 11 Feb 2009 20:26:19 +0100	[thread overview]
Message-ID: <4993265B.2000205@vip.cybercity.dk> (raw)
In-Reply-To: <Pine.LNX.4.64.0902101643170.16854@localhost>

Karthik Vishwanath wrote:
> Hi all,
> 
> I have been trying to come up with a way of getting find to give me a 
> list of all directories within a specific directory, without including 
> the parent in the list. I do not seem to be able to achieve it.
> 
> For instance, my directory tree has the following structure:
> .
> `-- Patient1
>     |-- 02-03-2009
>     `-- 02-10-2009
> 
> I want find to only match 02-03-2009 and 02-10-2009. However, the 
> following command gives:
> 
> $ find Patient1 -type d
> Patient1/
> Patient1/02-03-2009
> Patient1/02-10-2009
> 
> How do I stop matching the parent directory - "Patient1", in this case?
> 
> Of course, I could pipe this output through sed/grep to get what I need, 
> but I am curious if I can do it using find alone. All help is appreciated.
> 
> 
> Thanks,
> 
> -K
> 

Hello.

$ find Patient1 -type d -printf %P\\n

Remove the '\\n' if you don't want a newline printed after each line.

-- 
Flemming Greve Skovengaard                   Just a few small tears between
a.k.a Greven, TuxPower                       Someone happy and one sad
<dsl58893 @ vip.cybercity.dk>                Just a thin line drawn between
4011.25 BogoMIPS                             Being a genius or insane
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

      reply	other threads:[~2009-02-11 19:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-10 21:51 finding directories within a particular directory Karthik Vishwanath
2009-02-11 19:26 ` Flemming Greve Skovengaard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4993265B.2000205@vip.cybercity.dk \
    --to=dsl58893@vip.cybercity.dk \
    --cc=karthikv@Alum.Dartmouth.ORG \
    --cc=linux-newbie@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox