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