Solved

win32 path problem

Posted on 2001-06-26
5
184 Views
Last Modified: 2010-03-05
this works:
unlink glob("D:\\dir1\\dir2\\*");

now I try to use a net work drive with absolute path "\\home\dir$", so I do:
unlink glob("\\\home\\dir$\\dir1\\dir2\\*");
It doesn't work.

How should I do this?
Thanks
0
Comment
Question by:txholdem
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:marecs
ID: 6228751
unlink glob("\\\\home\\dir$\\dir1\\dir2\\*");
0
 
LVL 1

Author Comment

by:txholdem
ID: 6228788
tried that already. nope.
0
 
LVL 1

Author Comment

by:txholdem
ID: 6228892
It looks like no way this is going to work with back slashes. The only way to make it work is
//home/dir\$/dir1/dir2/*
0
 

Accepted Solution

by:
wkmatt42 earned 30 total points
ID: 6229278
The built-in glob function does not always work properly (at least not with network drives). Use the File::DosGlob instead. To override CORE::glob, type the following:

use File::DosGlob 'glob';

Now that glob works properly, unlink still won't. You can't delete each file individually using:

foreach (glob "\\\\home\\dir\$\\dir1\\dir2\\*")
{
    unlink;
}

There may be a way to delete all the files in the directory with one call, but I don't know how to do it. I suspect if you read up on the File package, you'd find a way. But unless you've got a huge number of files to delete, the above loop is pretty quick and ought to work.
0
 

Expert Comment

by:wkmatt42
ID: 6229297
Oops - I meant "You CAN delete each file ..."
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question