in reply to How do I open a file in a path that has spaces in the name?

This is a windows issue, when windows sees a path with spaces it reverts to 8.3 naming. This means that for a sub-directory such as Program Files gets renamed to: Progra~1 that is, it takes the first 6 characters of the pattern, appends the tilde, then a number representing the instance of that pattern. For example, in place of C:/Program Files/Jdk1.6.0_07/bin Use: C:/Progra~1/Jdk1.6.0_07/bin See this link for further details and full explanation of 8.3 naming http://support.microsoft.com/kb/142982
  • Comment on Re: How do I open a file in a path that has spaces in the name?

Replies are listed 'Best First'.
Re: Answer: How do I open a file in a path that has spaces in the name?
by CountZero (Bishop) on Feb 27, 2010 at 18:06 UTC
    Which version of Windows?

    I have no problem using files with spaces in the file or directory names in my Windows XP:

    use strict; use warnings; open my $fh, '<', 'c:\Directory with too many spaces\filename contains + spaces too.txt' or die "Cannot open file"; print while (<$fh>);

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James