just the folder name?
test the snippet I posted earlier... it should do it for you!

L-P

2008/9/3 brian54321uk <[EMAIL PROTECTED]>

> Thanks for the input, having tested Shawns solution, I will probably find
> at a later date that it is vital I include the full pathname in future
> output, so will subject the file to a second pass to get rid of the full
> pathname whilst I am at my present testing point.
> However, I would like to get just the folder name if that is a simple thing
> to amend.
> regards
> Brian
>
>
> Louis-Philippe wrote:
>
>> what Shawn just wrote could be ok for you Brian, but only if you change
>> working directory while processing files, because his script uses cwd() to
>> get directory (which reads 'current working directory')
>>
>> the other option would be to say:
>>
>> use File::Basename;
>> use File::Spec;
>>
>> my @alldirs = File::Spec->splitdir( File::Spec->rel2abs( dirname($file) )
>> );
>> my $dir = $alldirs[-1];
>>
>>
>> 2008/9/3 Mr. Shawn H. Corey <[EMAIL PROTECTED] <mailto:
>> [EMAIL PROTECTED]>>
>>
>>    On Wed, 2008-09-03 at 16:47 +0100, brian54321uk wrote:
>>     > Just tested this out and unfortunately instead of dirname replacing
>>     > abc123, I get a .
>>
>>    That's because the dirname is a '.'
>>
>>    Try:
>>
>>    use Cwd;
>>    if( (my $dir = dirname( $file )) eq '.' ){
>>     $dir = cwd();
>>    }
>>
>>
>>    --
>>    Just my 0.00000002 million dollars worth,
>>     Shawn
>>
>>    "Where there's duct tape, there's hope."
>>           Cross Time Cafe
>>
>>    "Perl is the duct tape of the Internet."
>>           Hassan Schroeder, Sun's first webmaster
>>
>>
>>    --
>>    To unsubscribe, e-mail: [EMAIL PROTECTED]
>>    <mailto:[EMAIL PROTECTED]>
>>    For additional commands, e-mail: [EMAIL PROTECTED]
>>    <mailto:[EMAIL PROTECTED]>
>>    http://learn.perl.org/
>>
>>
>>
>>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>

Reply via email to