[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Unlocking files



At 07.59 -0500 1998.12.14, Richard Christensen wrote:
>I have tried both of these.  Both chmod and FSpRstFLock fail to unlock
>the file. So why can I unlock it with ResEdit and not with these? Sharing
>is not enabled on these files and the files reside on my hard drive.  I
>just want to trash them, but so far the only way I can is to use ResEdit,
>which doesn't seem to mind about access privileges when the file in on my
>harddrive.  The only problem is that I have over 100 of these files I
>want to throw away.  I have tried shareware idea and what not. I thought
>for sure that MacPerl could force the unlink.  Any ideas?

I can't recall ever being unable to unlock a file from the Finder, which
you said was also a symptom.

Maybe this will suit you: if the files are all in one place, just drag them
to the trash and empty the trash while holding down "option".  This will
delete locked files.  If they are not all in one place or you want to move
them to the Trash with MacPerl for some other reason, use the rename()
function to move it to the trash, and then empty it while holding down
option.

#!perl -w
use Mac::Files;
my @files = ('Bourque:Desktop Folder:perltodo.pod copy');
foreach (@files) {
  (my $file = $_) =~ s/^([^:]+):.*:([^:]+)$/$1:Trash:$2/;  # abs. paths only
  rename($_, $file) or die "can't rename $_ to $file: $!";
}

--
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