At 13.17 -0500 2000.03.27, Ken Cartner wrote: >Is there anyway to delete (unlink) a folder that has items in it without >deleting the items first? > >I have a script that at one point will look to see if a local copy of a >folder exists, and if it does it will copy it to a server. The problem >is that the folder may and probably will have many nested folders and files. > >I can copy the folder and it's contents at one time with >FSpDirectoryCopy. Is there anything like that I can use to then delete >the folder & it's contents from the local mac? > >Any help would be appreciated. Thanks... As already noted, you can move to the trash. #!perl use Mac::Files; use File::Spec::Functions; # make path into FSSpec my $dir = MacPerl::MakeFSSpec 'Bird:linux:DeCSS copy:'; (my $vol, $name) = split /:/, $dir; # get trash for this volume, make new path my $trash = FindFolder(hex(substr($vol, 1, 4)), kTrashFolderType); my $new = catfile($trash, $name); # do all this just because if same name is in trash already, move # will fail, so we need to get a unique name under 31 characters if (-e $new) { my $i = 0; while (-e $new) { $i++; my $foo = $name . $i; chop $foo while length($foo) > 30; $new = catfile($trash, $foo); } } rename $dir, $new or die $!; __END__ Then you still need to empty the trash, which can be done with AppleScript / Mac::Glue / Apple events. -- Chris Nandor | pudge@pobox.com | http://pudge.net/ Andover.Net | chris.nandor@andover.net | http://slashcode.com/ # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org