[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] File globbing



Hmm, I must be doing something stupid:

$webpath="Wade'sWorld:Web Pages:Carriers.19.2.1998:";
$shortpath=$webpath;
chop($shortpath);

if (-e $shortpath)
{
    foreach(<$webpath*>)
    {
       unlink($_);
    }
    rmdir($shortpath);
}
mkdir($shortpath,0775);

This code fails to remove any files from the directory specified by
$webpath.  The path is correct, the directory exists, and the directory has
files in it.  It simply evaluates the foreach line, and moves onto the
rmdir line (which of course fails since files still exist).

I did a similar test with my $webpath="Wade'sWorld:Test" and it worked, so
I'm wondering if the multi-word directories (and file names) might be the
problem.

Anyone have any idea why this file glob isn't working?

Wade
---------------------------------------------------------------------------
Wade Williams                      "Put your message in a modem, and throw
Systems Engineer, CCIE #3373        it in the cyber sea."
Cisco Systems, Inc.                       - N. Peart
Brentwood, TN                        
615-221-2918                             
wwilliam@cisco.com    
---------------------------------------------------------------------------

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch