win32 path problem

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
LVL 1
txholdemAsked:
Who is Participating?
 
wkmatt42Commented:
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
 
marecsCommented:
unlink glob("\\\\home\\dir$\\dir1\\dir2\\*");
0
 
txholdemAuthor Commented:
tried that already. nope.
0
 
txholdemAuthor Commented:
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
 
wkmatt42Commented:
Oops - I meant "You CAN delete each file ..."
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.