Solved

win32 path problem

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

815 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

11 Experts available now in Live!

Get 1:1 Help Now