Script to index folders fails with (finder) alias-folders

  • 1st message: what a great place is this! after many years working with mac (incl. quickeys)
    i’m diving into the world of applescript, and have learned and still learning mostly by finding
    solutions in this great forum! thanks for that!

Pfew, have done said that i’ve got a ‘problem’ with a script that needs to return all
folders from a specific location, then all the foldernames needs some enhancement
(like e,g, tab & “—/”) and then its written to a textfile with the date as name.
So far all goes well with the (yet too long) script i have except one thing.
It doesnt return aliassed folders that are on an other drive, and obviously also not
the folder contents of that folder. Im using this line to get all the folders:

set theplace to every folder of the entire contents of folder thelocation as alias list

do i need to add an extra command to get the content of the aliassed-folders too
or do i need to specify command above more?

thanks in advance

Model: G5 Dual 1.8
AppleScript: v2.1 (80)
Browser: Safari 412
Operating System: Mac OS X (10.4)

Hi Juckz,

This:

set thelocation to choose folder
tell application "Finder"
	set theTargets to original item of (every alias file of the entire contents of folder thelocation)
end tell

should give a list of every target of aliases in your folder.

Best wishes

John M

Hi John,

Thanks you for this solution! It surely does return all targets of the aliassed folders
but it not the foldercontent of the folder of those aliasses.
Its going untill “folder → alias > folder”, not deeper. (How) do i have to repeat the
“every folder of the entire contents of folder theTarget” with your line when i
want a complete list? With the normal folders i use this part to get the full path and
like to have the same results with aliassed folders.



set theLocation to "HD:Jukebox:Albums:"
set theList to {}

tell application "Finder"

	set theTargets to every folder of the entire contents of folder theLocation as alias list
	set theCount to count every item of theTargets
	
	repeat with aFolder from 1 to theCount
		set tempdat to item aFolder of theTargets
		set theList to theList & return & tempdat as text
	end repeat

end tell
return theList


Currently i have a script that looks up in (in this case a folder with mp3-albums with genre-folders)
and counts these genres. Then it looks (in a repeat of that count) for the folder-contents of every
genre and adding this data to an endlist.

But again, it worx fine with ‘steady’ folders but fails with aliassed folders by not going
deep enough. (‘infinite depth’ would be the best result). Any (short) solution for that?

TIA!

Hi Juckz,

Once you have the list of the target folders you’ll have check weather it’s a folder and repeat the process you are doing with the original folder.

Best wishes

John M

Juckz;

If you get this working to some reasonable depth, please post your solution back to the forum. I have an urgent need to do the same thing with a folder containing 1.4 GB of document files and nested folders.

One problem I see (with my files) is that some sub-folders have aliases to files in other sub-folders, so there will be duplication.