Terminal commands into AppleScript


I want to use terminal commands to produce a list of files and folders in a particular directory.(effectivly a list of artists + albums + song titles, for the iTunes Library)

i currentntly navigate to the directory in terminal - cd Music/iTunes/iTunes Music and use the following ls -R */ > ~/Desktop/Artists Albums Tracks.txt to list the contents into a text file on the desktop

how can i make this work in a script? i cant seem to be able to make more then one “do script” command work in 1 window

i have this @ the moment

tell application “Terminal”
tell window 1
do script “cd ~/Music/iTunes/‘iTunes Music’”
tell window 1
do script “ls -R */ >~/Desktop/list.txt”
end tell
end tell
end tell

thanks D

You can do this without the Terminal. Does this do what you want to do? It appears to work here.

set command_ to "cd ~/Music/iTunes/'iTunes Music';ls -R */ >~/Desktop/list.txt"
do shell script command_


it works fine :slight_smile:

Thanks for your help