[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

In Mac Panther, How Can I Delete The Targets of a Folder of Aliases? Applescript?

Posted on 2005-04-27
3
Medium Priority
?
250 Views
Last Modified: 2013-12-26
Hi -

THE CHALLENGE
I have a folder of 7,000 aliases.
I need to delete the targets of these aliases.

EXTRA CREDIT (but not needed to win the points, )
Ideally, I'd like the alias deleted after its target is successfully found and deleted. That way I can see what aliases had no targets.

THE BACKGROUND
All of the targets are local, i.e., none are across a network.
Some aliases are broken.

DEEP BACKGROUND
Norton Disk Doctor made the folder of aliases to these files, which have damaged resources and therefore cannot be repaired and must be removed. As the alert reader can infer, I am in deep, deep trouble. Maybe later I can write upo the problem of never ending file corruption, but I don't have the strength to do that now. I have deadlines...

WHAT DOESN'T WORK FOR ME
Simply selecting a group and pressing Cmd R is not helpful, because alot of windows open that I have to go through one at a time. Also, if a target is not found for one item in a group, I get no feedback and can;t be sure of the result.

FileBuddy seems like it should have this functionality, but I can't see that it does.

I know how to make an Applescript and run it if given the code, but I'd need to be walked through any other kind of script.
0
Comment
Question by:drburt1
3 Comments
 
LVL 23

Expert Comment

by:brettmjohnson
ID: 13883029
Norton Disk doctor is not a very good disk diagnostic utility, especially for OS X 10.3.
I would not trust its diagnosis, and I certainly would not delete any files it finds
questionable without running DiskWarrior or TechTools first.
0
 

Author Comment

by:drburt1
ID: 13887434
Hi -

Yes, it's always good to remember what a mess Norton for Mac has turned into - Adobe has several postings about how Photoshop files can be damaged beyond recovery by NAV and Illustrator has problems.

BUT consider:-

1. Techtool Pro 4.04 (brand new) reports new damaged files if I run a 2nd test immediately after deleting all the damaged files it reports on its first test. (as does Norton DD)

2. TT reports all is well when DD reports 100s of damaged files.
Trying to open the files TT says are good proves DD was right - they can't be opened and an error message from any app trying to open it reports damaged resources.

3. At least DD makes an alias of the damaged files, leaving you to pick them off one by one.
TT just gives you a written list, so you can copy and paste each item one at a time into a search engine...

4. Disk Warrior while excellent for what it does seems not to address damaged resource forks, but does issue (in unhelpful list form) a report on damaged 'custom icons". (I wonder what that's about?)

Thanks for responding,

Burt
0
 
LVL 6

Accepted Solution

by:
clausbroch earned 2000 total points
ID: 13901134
This script should do the trick:

set the theFolder to (choose folder with prompt "Pick the folder containing the aliases:")
tell application "Finder"
      set aliasesToTest to every alias file of theFolder
      repeat with theAlias in aliasesToTest
            try
                  delete original item of theAlias
                  delete theAlias
            end try
      end repeat
end tell

The line "delete original item of theAlias" will fail if the original does not exist and the alias file will therefore not be deleted by "delete theAlias"
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses
Course of the Month20 days, 10 hours left to enroll

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question