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

Re: [MacPerl] BBEdit & MacPerl




At 4:07 PM +0000 2/19/99, Jay Bedsole wrote:
>Oops! Two points I forgot to mention...
>
>(1)  Once you've made the mistake and have an invisible
>     file in the "Temporary Items" folder, you're sort of
>     'hosed'. You can't get at the file to delete it (you
>     have to reboot - nice user friendly thing, that?)
>     Repeated attempts to get MacPerl to switch to Alpha
>     with your MacPerl generated changes will always pull
>     up your invisible version... bummer. The only thing
>     you can do is reboot to delete the invisible file or
>     rename your original to something new and work with
>     that...

I got tired of rebooting when I made that sort of mistake, so I put together the simple script below and put it in a folder called "VisibleTemp" on my desktop. It lets you delete remove the invisible file from the real "Temporary Items" folder and put it in VisibleTemp, where you can do what you want with it.

Matt





-----------------------------------
#!perl
#
# tempCleaner  
# 
# Author: Matt Morse (matt@apple.com)
# Last Modified: 5/1/98
#
# 

use Cwd;
use Mac::Files;
use File::Copy;

$tempFolder = FindFolder(kOnSystemDisk, kTemporaryFolderType);
print "tempFolder is $tempFolder\n";
$desktop = FindFolder(kOnSystemDisk, kDesktopFolderType);
$visibleFolder = "$desktop:VisibleTemp";

opendir (INPUTDIR, $tempFolder) || die ("Unable to open directory $tempFolder.\n");
@files = readdir(INPUTDIR);
closedir(INPUTDIR);

foreach $tempFile (@files) {
     $answer = MacPerl::Answer("Move $tempFolder:$tempFile? to $visibleFolder?", "Yes", "No");
     if ($answer) {
        print "Moving $tempFolder:$tempFile\n";
        copy ("$tempFolder:$tempFile", "$visibleFolder:$tempFile") || print "Couldn't copy $tempFile to $visibleFolder\n";
        unlink ("$tempFolder:$tempFile") || print "Couldn't delete $tempFolder:$tempFile\n";
     }else {
        print "Not moving $tempFolder:$tempFile\n";
     }
}
undef @files;




***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch