At 07.09 -0500 1999.01.07, G. Ann Campbell wrote: >Chris Nandor wrote: >> <snip> >> Second, unlink() does work fine in MacPerl. Did you check the result of >> the unlink()? Did Perl for Dummies tell you to check the error? >> >> unlink($file) or die "Can't unlink $file: $!"; >> >> Chances are that you have the wrong path or something. unlink() does work >> fine. > >when I run: > > #!/usr/local/bin/perl > require "GUSI.ph"; require "StandardFile.pl"; require "FileCopy.pl"; > #yes, I know there are extra requires > > $file = &StandardFile'GetFolder("Choose a folder to kill."); > unlink($file) or die "Can't unlink $file: $!"; > >MacPerl returns: > > # Can't unlink Phred:Desktop Folder:Trash me: . > File 'Untitled'; Line 5 > >What am I doing wrong? You can't unlink a folder. Use File::Find to iterate through the folder to delete the whole thing: # untested and dangerous code use File::Find; finddepth(sub { if (-f $_) {unlink} elsif (-d $_) {rmdir} }, $folder); -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6']) ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch