in reply to Re: Re: Re: Re: Unlinking...
in thread Unlinking...
See the readdir page for most of an example:
Which we can adapt like:opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!"; @dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR); closedir DIR;
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.opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!"; @files = grep {/\.txt$/} readdir(DIR); closedir DIR; unlink @files;
|
|---|