Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: I go crazy with windows filenames with spaces!

by Anonymous Monk
on Oct 05, 2011 at 21:29 UTC ( #929885=note: print w/ replies, xml ) Need Help??


in reply to Re^2: I go crazy with windows filenames with spaces!
in thread I go crazy with windows filenames with spaces!

I could not find

Win32::GetShortPathName($fullpath);

But I've knocked up this which seems to work

use Win32::API; sub GetShortPathName { my $GetShortPathName = new Win32::API('kernel32', 'GetShortPathName +A', 'PPN', 'N'); die "Can't import API GetShortPathNameA:\n$!" unless defined $GetSh +ortPathName; my $longpath = shift; my $length = 1 + length $longpath; my $shortpath = ' ' x ($length); $length = $GetShortPathName->Call($longpath, $shortpath, $length); return substr($shortpath, 0, $length); }


Comment on Re^3: I go crazy with windows filenames with spaces!
Select or Download Code
Re^4: I go crazy with windows filenames with spaces!
by Anonymous Monk on Oct 06, 2011 at 10:20 UTC

    I could not find Win32::GetShortPathName($fullpath);

    What does that mean?

    Win32::GetShortPathName has been available since perl 5.6

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://929885]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2014-08-22 06:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (148 votes), past polls