Solved

win32 path problem

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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 …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

929 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

13 Experts available now in Live!

Get 1:1 Help Now