more useful options | |
PerlMonks |
Yea, though i walk through the shadow of File::Find & Directory Tree Deletion...by wufnik (Friar) |
on Jul 12, 2004 at 22:49 UTC ( [id://373765]=perlquestion: print w/replies, xml ) | Need Help?? |
wufnik has asked for the wisdom of the Perl Monks concerning the following question:
ok. File::Find. earlier today, i was looking rather smugly
at Jendas node on File::Find; File::Find considered hard?, thinking
how *i* would not be caught by the vagaries of the module,
thinking even how i would start using merlyns File::Finder, once i had completed a simple task - removing directories via File::Find. after all, there is a recipe for it in the perl cookbook. nothing could go wrong... several fraught hours later, my confidence & hubris had dissolved in the acid of File::Find... to boot, my presumption led to the deletion of many funky files in my dat directory. after much wailing and gnashing of teeth, i appeal for advice, and hayulp... the following script takes directories as arguments, and attempts, quite simply, to delete them after deleting all files inside them. actually, it's a little more generic than that - it is recursive directory deleter, and will delete any subdirectory inside the directories mentioned. it half works, be careful! i should mention, it's pretty much directly stolen from the cookbook. now, run this through cygwin perl (5.8.2), using something like where a and b are directories that contain a.txt and b.txt respectively, and you will get a satisfying: run it through activestate (5.6.1) perl - and the deletion of the directories seems impossible: here's the results: most depressing. i am sure that it's because the process is sitting in the directory it is attempting to delete. but if this *is* the case, how did rmtree1 from the cookbook ever... get into the cookbook! and does anyone know how the above problem might be solved within the confines of activestate perl? many thanks for any help
...wufnik -- in the world of the mules there are no rules --
Back to
Seekers of Perl Wisdom
|
|