Does anybody know how to move some folder to library playlist in iTunes?

I can move some folder to another folder using the following script:

tell application "iTunes"
    move folder playlist "3" to folder playlist "1"
end tell

The initial state is:


After executing the script state will be:


But I don't know how to move folder "3" on the same level as folder "1". Folder "1" is located in library. I mean the following structure:



You can see picture what I want to do using AppleScript enter image description here

  • Can you describe a bit more about your needs? Why exactly AppleScript? What is the exact path to "1" and the exact path to "3"? Etc... If you could accept alternatives via Bash scripting, etc. – Anton Todorov Aug 6 '15 at 18:27
  • @Anton Todorov, What alternatives via Bash scripting do you have in mind? What Artem G.is trying to do cannot be done in bash unless done using osascript, which execute AppleScripts and other OSA language scripts. So doing it from the Script Editor might actually be the easier way to go since bash by itself can't cut it as the objects referenced, i.e. folder playlist "n", are not actual directories of the host filesystem and therefore do not have paths like /Users/$USER/Music/iTunes/.. and are an entry in an XML file at that location, i.e. the "iTunes Music Library.xml" file. – user3439894 Aug 6 '15 at 19:38
  • @user3439894 I did not understand your comment, but anyway... the only thing I got is that the task is unable to be performed via Bash... :D – Anton Todorov Aug 6 '15 at 21:48
  • @AntonTodorov, you are right. I mean folders in iTunes. These folders are not referenced to directories in file system. These folders are logical folders in iTunes. By default folders created in library playlist (but I'm not sure in terminology, it is just root folder in general meaning). And I want to move some subfolder to root or library. – Artem G. Aug 7 '15 at 6:03

@ArtemG. then I assume that this operation could be done by editing the playlist file that is loaded by iTunes. It should be located in ~/Music/iTunes/

Information is according to the posts marked as helful over here (https://discussions.apple.com/thread/2439817)

  • No. Folder is in iTunes Application, not in file system! – Artem G. Aug 7 '15 at 8:47
  • Yes, as mentioned, that information is stored in the playlist file... read carefully. – Anton Todorov Aug 7 '15 at 10:16
  • What is "the playlist file"? – Artem G. Aug 7 '15 at 10:30
  • The needed file is called iTunes Music Library.xml. You just have to find and follow the logic when editing it. P.S. I recommend you to make yourself a backup copy of the file before you start working. – Anton Todorov Aug 7 '15 at 10:38
  • 1
    If you mean "iTunes Library.xml" file, you are wrong. Editing of this file is senselessly. 1) the latest version of iTunes can work without this file, so the file is not mandatory. 2) iTunes doesn't read this file. iTunes reads iTunes Library.itl file, it is binary and encrypted. – Artem G. Aug 7 '15 at 10:43

You must log in to answer this question.

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