Creating a temporary folder of file aliases

I am using a bunch of spotlight driven finds and would like to add to this. My subs can return the file paths as POSIX or an Alias list. I think I can do what I want from a Finder point of view using the Alias List but think it would be nice if someone could show me how to do this in shell from (might be quicker?). What I need to pipe is the mdfind results into a new directory mkdir? but I want aliases in this new folder? I have looked at symlink? is this the right command to be looking at?

Found what I was after. So save your efforts.

Spoke too soon. The command i’ve found to do this for me takes ‘file’ as input and ‘file’ or ‘directory’ as output. So I’ve been able to get this to work by calling the shell in an AppleScript loop but I was hoping to just call a shell the once is there a way in which I can pass this command an array/list to iterate thru?

The command I’ve tried using is "ln -s "

Try this out. The Ruby script is looking for a return “\r” separated list of names, not file paths.
Minor adjustment to change to paths. I did it this way for easy testing using the ls command.

AppleScript

set originatingFolder to POSIX path of ((path to desktop as Unicode text) & "img")
set destinationFolder to POSIX path of ((path to desktop as Unicode text) & "img2")
set fileNames to do shell script "ls ~/desktop/img/"

do shell script "/usr/bin/ruby ~/desktop/ln_files.rb " & originatingFolder & space & destinationFolder & space & fileNames

Ruby Script:

Well I have know idea how that works but it does. Can the ruby script just be a text variable so that I don’t need to have any additional files? I was trying but with no sucess with something like this:

do shell script “foundFiles=( " & File_List & " )
for (( i = 0 ; i < ${#foundFiles[@]} ; i++ ))
do
ln -s echo ${names[$i]} /Users/marklarsen/Desktop/Find Results/
done”

but I think I needed to replace \r with space for the array?

it might be easier to write the whole thing in bash or Ruby. Is there something
specific that you need to use AppleScript for?

What does your search code look like?

Im in the early days with this but basically from the AppleScript point of view its just a bunch of subs that use if/else conditions to construct my search strings the resulting info can then be passed to other subs depending on wether I want to pass the POSIX path strings to JavaScript or use else where within AppleScript hoping its going to end up as a loaded library if I get it working properly.

The collecting of symbolic links to a single folder location is so I can have “Bridge” open this in a file browser window giving me previews and click to open originals for editing.

The whole thing in Ruby would be a very nice option and probably lightning fast too but well out of my skills range. Its pretty fast as is a part from the finder loop to create the file aliases to my location. I will keep plugging away. BTW that ruby script worked very rapid & Thanks

You’re welcome. If you decide to convert it to Ruby and need some help, let me know.

Also, there is a very good tutorial on Lynda.com on learning Ruby.