[color=darkblue][b]
Hi,
I just purchased a tiny little USB MP3-player running with an SD-Card. In the Internet I found a great Script to copy playlists directly from within iTunes to any folders or Volumes. Great!
Unfortunately the SD Card is formatted with FAT32 and so the Ressource fork of every Music File is moved into a seperate file starting with “._nnn”. There is also the “.DS_Store” file on the volume. These files cause some errors on my Player and he sometimes crashes. When I delete the files with my PC from the card everything runs fine.
I have attached the whole Script. Who is able to amend a line of AppleScript code to delete these files after the copy procedure has finished?
I have just started with AppleScript (I am familiar with several computer languages), but this issue seems to be not so easy because I couldn’t find an idea of how this could be done (shell script? loop? just a single ‘delete’???)!
Thanks very much in advance!
[/b][/color]
(*
"Put This Where I Want It" v1.2 for iTunes
written by Doug Adams
dougadams@mac.com
Get more free AppleScripts and info on writing your own
at Doug's AppleScripts for iTunes
http://www.malcolmadams.com/itunes/
*)
global tc, plural
tell application "iTunes"
if selection is not {} then
set sel to a reference to selection
tell me to pluralize(count sel)
set choose_folder_prompt to ("Select a folder to copy the selected track" & plural & " to...")
set new_site to (choose folder with prompt choose_folder_prompt)
if new_site is not false then
set tc to 0
with timeout of 30000 seconds
repeat with f in sel
if f's class is file track then
set fpath to (get f's location)
tell me to move_it(fpath, new_site)
end if -- skip if incorrect type of track
end repeat
end timeout
tell me to pluralize(tc)
display dialog ("Done!" & return & return & ¬
(tc as string) & " track" & plural & " of " & (count of sel) as string) & " selected were copied to folder:" & return & ¬
((get characters 1 thru -2 of (new_site as string)) as string) buttons "Thanks" default button 1 with icon 1
end if -- cancel from choose folder
else
display dialog "Nothing has been selected." buttons {"Cancel"} default button 1 with icon 0
end if -- no selection
end tell
to move_it(fpath, new_site)
tell application "Finder"
try
duplicate file fpath to folder new_site with replacing
set tc to tc + 1
on error eM number eN
display dialog "Error " & eN & return & eM with icon 2
end try
end tell
end move_it
to pluralize(X)
set plural to "s"
if X is 1 then set plural to ""
return plural
end pluralize
[/b]