<?xml version="1.0" encoding="windows-1252"?>
<node id="828135" title="How to Get the Last Subdirectories" created="2010-03-11 15:54:35" updated="2010-03-11 15:54:35">
<type id="115">
perlquestion</type>
<author id="670339">
bichonfrise74</author>
<data>
<field name="doctext">
Given the output from the code below, how would I get the final subdirectories for a certain directory?

&lt;code&gt;
#!/usr/bin/perl

use strict;
use File::Find;

find( sub { print "$File::Find::name \n" if -d }, '/tmp/a' );
&lt;/code&gt;

Below is the output from the code above.
&lt;code&gt;
/tmp/a
/tmp/a/b
/tmp/a/b/c
/tmp/a/b/c/e
/tmp/a/b/d
/tmp/a/b/d/g
/tmp/a/b/d/g/h
/tmp/a/b/d/g/i
/tmp/a/b/k
&lt;/code&gt;

But the output that I want is

&lt;code&gt;
/tmp/a/b/c/e
/tmp/a/b/d/g/h
/tmp/a/b/d/g/i
/tmp/a/b/k
&lt;/code&gt;

So, for example, I do not need the '/tmp/a' because it is still has sub-directories underneath it. 
&lt;br&gt;&lt;br&gt;
Thanks in advance.</field>
</data>
</node>
