Code Comments
Programming Forum and web based access to our favorite programming groups.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. Andrew
Post Follow-up to this messageandrewmchorney@cox.net 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
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.