Re: perl question
>> > Here's one for some of the perl guys....
>> >
>> > I want to delete a directory that will have files in it...
>> > I don't know the name of the files.... there for wildcards might
>> > be needed....
>> >
>> > I understand that "rmdir" will wipe out an empty directory....
>> > and "unlink" will wipe out files (only if I know the names of the files)
>> >
>> > What would be a nice command to remove a dirtory that had files in it?
>> > Even better.... what would be a nice command to delete all files
>> > in one directory... (leaving the directory intact)
wt> sub emptydir {
wt> my $dir = shift;
wt> [..skip..]
wt> }
wt> but this code is untested and is likely to cause brain damage
wt> and multiple scleroses.
Do not reinvent wheel :). Use standart Perl modules.
use File::Path;
rmtree([$dir]);
See File::Path docs for more info.
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Reply to: