Re: Extracting file name from full name
- From: krahnj@xxxxxxxxx (John W. Krahn)
- Date: Thu, 27 Sep 2007 16:04:59 -0700
andrewmchorney@xxxxxxx wrote:
Hello
Hello,
I have a string that contains a full path and file name. What is
the easiest way to extract the file name? For example the path is
/dir1/dir2/dir3/file.txt.
$ perl -le'
use File::Basename;
my $full_path = q[/dir1/dir2/dir3/file.txt];
my $file_name = basename $full_path;
print $file_name;
'
file.txt
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
.
- References:
- Extracting file name from full name
- From: andrewmchorney
- Extracting file name from full name
- Prev by Date: Extracting file name from full name
- Next by Date: Bundle::CPAN install error
- Previous by thread: Extracting file name from full name
- Next by thread: Bundle::CPAN install error
- Index(es):
Relevant Pages
|