How do I cleanup the result from this script:
property parentdir : "/Volumes/DTP/Leenbakker/orders"
do shell script ("find " & quoted form of parentdir & " -type d -maxdepth 1")
set Leenbakker to the result
set master_list to {}
repeat with i from 1 to (count of paragraphs of Leenbakker)
copy paragraph i of Leenbakker to end of master_list
end repeat
set new_master_list to {}
repeat with this_master_item in master_list
try
set oldDels to AppleScript's text item delimiters
set AppleScript's text item delimiters to "/"
set theText to text item 5 of this_master_item
if theText is not in new_master_list then copy theText to end of new_master_list
set AppleScript's text item delimiters to oldDels
end try
end repeat
The result is not cleaned
This is what I get:
tell current application
do shell script "find '/Volumes/DTP/Leenbakker/orders' -type d -maxdepth 1"
"/Volumes/DTP/Leenbakker/orders\r/Volumes/DTP/Leenbakker/orders/36744_voordeelbonnen_eindhoven\r/Volumes/DTP/Leenbakker/orders/36749_leenbakker sollicitatie\r/Volumes/DTP/Leenbakker/orders/36888_leenbakker\r/Volumes/DTP/Leenbakker/orders/37067_koofstreamer
What I want is for example only: 36744_voordeelbonnen_eindhoven
–Peter –