Edwards, Mark (CXO) wrote:
Try File::Basename and you won't have to reinvent the wheel.
-----Original Message-----
From: Neil [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 04, 2002 9:48 AM
To: [EMAIL PROTECTED]
Subject: perl-win32-users - Best way to return a path to a file ?
Importance: Low
Hi,
I have just started to code up a subroutine to return the path only
from a complete path to a file. This must the the 3rd time in two
months as I have mislaid the routine on my HD and searching for it
would probably take longer than the coding.
When writing this routine, I always seem to take the long way
round and this got my curiosity going and wondering what other
solutions people have come up with that are more elegant and obvious
than my own.
I find many times that looking at someone elses code can provide an
"aha" moment that last far beyong the snippet involved.
If anyone cares to share their code for this - that would be cool.
If not - thats cool too. I am gonna head back to the editor and
throw it together - again ;-) and I'll post it later so we can flame
it in a public display of humiliation ;-)
Neil
if you have 'use Win32;' at the head of your script:
from 'perldoc win32'
Win32::GetFullPathName(FILENAME)
[CORE] GetFullPathName combines the FILENAME with the current drive
and directory name and returns a fully qualified (aka, absolute)
path name. In list context it returns two elements: (PATH, FILE)
where PATH is the complete pathname component (including trailing
backslash) and FILE is just the filename part. Note that no attempt
is made to convert 8.3 components in the supplied FILENAME to
longnames or vice-versa. Compare with Win32::GetShortPathName and
Win32::GetLongPathName.
This function has been added for Perl 5.6.
--
Michael Higgins
Development Associate
Joseph Slifka Center
for Jewish Life at Yale
[EMAIL PROTECTED]
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs