in reply to Re: Re: Re: Unlinking...
in thread Unlinking...

Ok, can I get a code example for that? because i havent gotten into that stuff in my Perl Bible yet. Thanks, you get ++ for all your help

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Unlinking...
by swiftone (Curate) on Nov 22, 2000 at 02:35 UTC
    It's much like SteveAZ98 did below.

    See the readdir page for most of an example:

    opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!"; @dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR); closedir DIR;
    Which we can adapt like:
    opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!"; @files = grep {/\.txt$/} readdir(DIR); closedir DIR; unlink @files;
    Notice that unlink is not related to the directory functions. Also, arturo reminded me that the filesystem is considered untrusted, so this still may not work with Taint checking.