2

I have i.e. a folder full with alias from everywhere on my system. Now I want to give exactly this files as the originals to an extern hard drive or what else.

Is there a way to simply take these alias and copy their originals into a second folder?

2

I’ve put together a little AppleScript for you. If you use the Script Editor to save it as an applet you can drag & drop folders on it. The script will first ask for the destination folder and then scan the dropped folders for any aliases contained. If it finds any it will copy the original items to the destination folder specified.

Here’s the code:

on open droppedItems
    try
        set destinationFolder to choose folder with prompt "Select destination folder:"
    on error
        return
    end try

    repeat with itemCount from 1 to length of droppedItems
        set theFolder to item itemCount of droppedItems

        tell application "Finder"
            if folder (theFolder as string) exists then
                set folderItems to list folder theFolder without invisibles

                repeat with folderItemCount from 1 to length of folderItems
                    set filename to (item folderItemCount of folderItems)
                    set theAlias to ((theFolder as text) & filename) as alias
                    try
                        set originalFile to original item of theAlias -- is Finder alias?
                        duplicate originalFile to destinationFolder
                    on error
                        display dialog (theAlias as string) & " doesn't seem to be an alias. Skipping."
                    end try
                end repeat
            else
                display dialog (theFolder as string) & "is not a folder. Skipping."
            end if
        end tell
    end repeat
end open

It is neither pretty nor feature complete but rather meant to show you a possible way to go. I. e. it doesn’t traverse any subfolders. Also, there’s no checking of file existence before copying. Anyway, it might still be what you need. Have fun!

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .