Solved

win32 path problem

Posted on 2001-06-26
5
177 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
  • 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now