How to remove orphaned Mac OSX aliases?

I have been searching for days now and I cannot find the a solution to what I want to do. I want to find all “orphaned aliases” on my Mac and automatically deleted them. I do not want to fix them.

Here’s the problem:

I wanted to get some public domain images from Flickr. There were over 5,000 images. I did not want to download them by hand, so I made a little, php-script to scrape them.

Each image on Flickr can have several different sizes. These images use the following naming convention:

filename + size designation + file extension

There are at least 12 different size designations on Flickr.

They are: s,q,m,sq,n,t,z,c,b,o,h,k.

Size Name Approximate Dimensions Designation
Square 75 (75 x 75) _s.jpg
Square 150 (150 x 150) _q.jpg
Thumbnail (75 x 100) _t.jpg
Small 240 (180 x 240) _m.jpg
Small 320 (240 x 320) _n.jpg
Medium 500 (375 x 500) .jpg*
Medium 640 (480 x 640) _z.jpg
Medium 800 (600 x 800) _c.jpg
Large 1024 (768 x 1024) _b.jpg
Large 1600 (1200 x 1600) _h.jpg
Large 2048 (1536 x 2048) _k.jpg
Original Depending on original size _o.jpg
* ends only with .jpg without a letter designation

There might be more, but these are the main designations that I have seen in the public domain folder that I am scraping.

An example of an image address at Flickr is as follows:

With the exception of the _h and _k designations, all of the other designations use the same file name. In this example image, the file name is:


Using this information, I made a little scraper script that looked at the gallery pages in the public domain account at Flickr and retreived the file name of each image in the archive. The script then appended the following size designations to the file name _s.jpg, _q.jpg, _m.jpg, _sq.jpg, _n.jpg, _t.jpg, _z.jpg, _c.jpg, _b.jpg, _o.jpg and output it to an html file. I then used that information with the program SiteSucker to download all of the images. A folder was created for each image and all of the file sizes were downloaded into that folder. In the above example, the destination folder would be: 2/1623.

The problem is that not every image file has all 10 sizes. When an image is missing, Flickr servers a placeholder image marked with the appropriate size designation (for example: photo_unavailable_sq.jpg). Those 10 placeholder images are saved to one location. Sitesucker then created an alias to point back to those 10 placeholder images. Therefore, throughout the 5,000 image folders that are now archived for offline use, I have numerous placeholder aliases mixed into them.

I have tried different methods of searching for them on the Mac, but they seem to be invisible to all search functions. I do not want to have to go through all 5,000 folders and delete them individually. That would take too long.

The easiest way to get rid of them would be to delete the original 10 images and then to automatically delete all aliases connected to them. That is what I have been trying to do without success. I now have an unknown amount, but probably in the thousands, of orphaned aliases scattered throughout the archive and I do not know how to get rid of them without doing it by hand.

So my question is:

How do I delete orphaned aliases on a Mac?