Hi,
Is it possible to set a folder name to a name taken from a text string of a variable?
Here’s part of a script that I’m working on that should set the artist name to a new folder, named “untitled folder”. This would change the folder name from “untitled folder” to " whatever artist name ". If there’s some method for setting the name of the new folder right away I guess that would get the job done too.
This script seems to work if you check the log on the script editor but it does NOT change the actual folder names in Finder.
Script:
property separator : " / "
set AppleScript's text item delimiters to {""}
tell application "iTunes"
set curSongs to selection
repeat with thisSong in curSongs
set fileloc to location of thisSong as alias
set details to artist of thisSong & " / " & album of thisSong
set comment of thisSong to details
set AppleScript's text item delimiters to " / "
set txt to text items of details
set artistName to text item 1 of txt
set albumName to text item 2 of txt
tell application "Finder"
set musicFolder to folder of folder of folder of fileloc
set x to folders in musicFolder --make new folder under this line
make new folder in musicFolder
repeat with x in musicFolder
set newFolderName to artistName as string
if name of x contains "untitled folder" then
set name of x to newFolderName
end if
end repeat
end tell
set AppleScript's text item delimiters to {""}
end repeat
end tell
beep