Categories: Misc / DotNet / Java / Coder / Linux / PHP Ask - La ask - La Answer

Itunes Music Folder Location

Is there a way to script the changing of the 'iTunes Music Folder Location'.

I can't find a reference to it in the iTunes Applescript Dictionary.

I'd like to create a simple script to be able to point it to the local folder or an external drive on a server. The actual library file is unimportant.

Thanks,

Michael
[369 byte] By [laumusic] at [2007-11-9 14:48:17]
# 1 Re: Itunes Music Folder Location
You could have the AppleScript run a shell script or run shell commands.

For example:
#!/bin/sh
mv ~/Library/Music/iTunes/iTunes\ Music /Volumes/FireWire
ln -s /Volumes/FireWire/iTunes\ Music ~/Library/Music/iTunes/iTunes\ Music

The iTunes Music folder is now on the "FireWire" drive but iTunes can't tell the difference. This saves you having to change the preference in iTunes. Symlinks (familiar to UNIX/Linux users) are more robust than Mac aliases and are safe to use.

If you need help with running a shell script or shell commands from AppleScript, no problem.
bracken at 2007-11-15 17:25:08 >
# 2 Re: Itunes Music Folder Location
Bracken,

What exactly does this do?

I thought, with my limited knowledge of Unix, the mv means MOVE. Would it physically move the library folder or just resets some kind of internal preference that is easily accessable through UNIX.

Is the iTunes Music Folder Location Applescriptable like the Encoder type?

How would I go about making an Applescript to run the shell command.

Thanks,

Michael
laumusic at 2007-11-15 17:26:10 >
# 3 Re: Itunes Music Folder Location
I think the original poster wanted to set the location in iTunes' Advanced Preferences. This has to be done manually.

I have not tried a symlink or alias to the Music folder. I imagine this would work.
Doug Adams at 2007-11-15 17:27:08 >
# 4 Re: Itunes Music Folder Location
Setting your designated Music folder to an alias which points to your real Music folder will result in iTunes recognizing the real folder. It has to. That's how iTunes knows where newly added files will go. It's how the filepaths will be displayed in the xml file, and it's what is returned in a track's location AppleScript property.

In addition (regarding the original topic, some method to set the "iTunes Music folder location" in Advanced Preferences) GUI scripting can't touch iTunes Preferences either.
Doug Adams at 2007-11-15 17:28:03 >
[an error occurred while processing this directive]
[an error occurred while processing this directive]