Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by Anonymous Monk
on Jan 19, 2010 at 15:07 UTC ( #818206=note: print w/replies, xml ) Need Help??


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

Win32::GetShortPathName($fullpath);
  • Comment on Re^2: I go crazy with windows filenames with spaces!

Replies are listed 'Best First'.
Re^3: I go crazy with windows filenames with spaces!
by Anonymous Monk on Oct 05, 2011 at 21:29 UTC

    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); }

      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://818206]
help
Chatterbox?
[choroba]: As discussed in Using the DATA file handle for ARGV, I usually start my "fun" scripts with *ARGV = *DATA{IO} unless @ARGV;
[choroba]: this was just a remainder
[Discipulus]: ah thanks i forgot that thread (even if i saved it in my homenode)..
[Discipulus]: the node i discovered yesterday nigth was also interesting

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2016-12-06 08:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (101 votes). Check out past polls.