Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

File::Find with win32 direct~1's containing spaces.

by one4k4 (Hermit)
on Jun 26, 2002 at 01:16 UTC ( [id://177257]=perlquestion: print w/replies, xml ) Need Help??

one4k4 has asked for the wisdom of the Perl Monks concerning the following question:

I'll admit, I've done all of 15 minutes of research into this possible issue, but here goes.

Has anybody had any problems with File::Find and long path-names? We have paths similar to x:\whatever\weekly and biweekly\something else\etc.

At first glance my script (which is to archive all files within the directories under a starting point into directory\archive\db-gathered-date) is having problems with directories similar to the above.

If anybody is interested, I'll post code snippets, but I'm more-or-less simply asking the grape-vine if there have been any "issues" before.

_14k4 - perlmonks@poorheart.com (www.poorheart.com)

Replies are listed 'Best First'.
Re: File::Find with win32 direct~1's containing spaces.
by gav^ (Curate) on Jun 26, 2002 at 01:36 UTC
    I've not ever had a problem. I just whipped up a test script:
    use File::Find; find(sub { print "$File::Find::name\n" if -d }, "c:/program files/");
    And this gives me entries like:
    c:/program files/Netscape/Communicator/Program/NetHelp/netscape/compos +er c:/program files/InstallShield Installation Information/{0AD84416-63A4 +-4CF3-BDDF-8FA866711FB0}
    So without posting your code I'm not sure what's up :)

    gav^

Re: File::Find with win32 direct~1's containing spaces.
by grantm (Parson) on Jun 26, 2002 at 11:36 UTC

    Where I have run into problems is using the system() function with files containing spaces. The Win32 command shell is pretty limited when it comes to quoting (double quotes or nothing). To work around that, I sometimes do this:

    my $short_name = Win32::GetShortPathName($long_name);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://177257]
Approved by gav^
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-19 17:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found