Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Relocation of a non-standard iTunes library structure' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Relocation of a non-standard iTunes library structure
Authored by: Graff on Apr 23, '03 06:49:22PM
It sounds like this would be a good job for using aliases. If the only reason you are keeping your files apart is to know what to share and what not to share, can't you just make 3 folders full of aliases to the files. Each would have aliases to the various music files. You could then allow iTunes to manage your music library all it wants and you would never have to worry about it. If you wanted to share a certain type of file, just share the folder full of the proper aliases.

The only trouble might be when you add a new song to iTunes, but that can be handled via a simple script to add an alias to the proper folder. Here's a sample script. Enter it into Script Editor, make a folder to hold the aliases, change the target_folder variable to the path of this folder, and save it with an appropriate name in "~/Library/iTunes/Scripts/". Then just select the tracks you want to file an alias to and select this script from the Script menu in iTunes. You can repeat the process with as many categories as you want, just make another folder and another script, changing the appropriate bits.

-----------

set the target_folder to "Path:To:Your:Folder:"

tell application "iTunes"
	set these_tracks to the selection of browser window 1
	if these_tracks is {} then error "No tracks are selected in the front window."
	
	set these_files to {}
	repeat with i from 1 to the count of these_tracks
		set the end of these_files to (the location of item i of these_tracks)
	end repeat
end tell

tell application "Finder"
	activate
	set the copy_counter to 0
	repeat with i from 1 to the count of these_files
		set the replace_flag to true
		set this_file to (item i of these_files) as alias
		set this_name to the name of this_file
		if (exists file this_name of folder target_folder) then
			display dialog ("The file "" & this_name & 
				"" already exists in the chosen folder." & 
				return & return & "Should it be replaced?") 
				buttons {"Cancel", "Skip", "Replace"} default button 3
			if the button returned of the result is "Skip" then
				set the replace_flag to false
			end if
		end if
		if the replace_flag is true then
			make new alias file at folder target_folder to this_file with replacing
			set the copy_counter to the copy_counter + 1
		end if
	end repeat
end tell

tell application "iTunes" to activate


[ Reply to This | # ]