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

Re: [MacPerl] Filename globbing



>>     unlink("./foo/*");
>
>I must point out, first, that this construct is far from portable among
>Unix boxes even. unlink() does not normally allow globbing (Nor should it,
>IMHO).

Interesting.  The script in question has (until now) only been used on
SunOS Unix boxes.  

>>Given that installing csh is not really an option, how can
>>I properly glob filenames in a folder whose name includes
>>spaces?
>
>It might be possible for me to fix glob.

It would seem that somebody will need to fix it, but I don't know if it's
really your responsibility.  MacOS isn't the only system which allows 
spaces
in filenames and which doesn't normally have csh, after all.  As Perl 
continues its spread to non-Unix systems, I'd expect this to be a more 
common problem.

Several people suggested using opendir/readdir/closedir instead of glob.
I considered this, but I didn't like the idea of needing to iterate
over the filenames.  There are likely to be ~100 files.  Instead,
I'm doiing a chdir over to the target folder, followed by an
unlink(glob ":*"), and a chdir back to the original directory.
This works pretty well.


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