Okay i solved my problem but why arent the folder renamed?
propertyoldfolder : ""
property newfolder : ""
property SS : "."
property RS : " "
to replaceText(someText, oldItem, newItem)
(*
replace all occurances of oldItem with newItem
parameters - someText [text]: the text containing the item(s) to change
oldItem [text, list of text]: the item to be replaced
newItem [text]: the item to replace with
returns [text]: the text with the item(s) replaced
*)
set {tempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, oldItem}
try
set {itemList, AppleScript's text item delimiters} to {text items of someText, newItem}
set {someText, AppleScript's text item delimiters} to {itemList as text, tempTID}
on error errorMessagenumbererrorNumber-- oops
set AppleScript's text item delimiters to tempTID
error errorMessagenumbererrorNumber-- pass it on
end try
return someText
end replaceText
tell application "Finder"
set these_items to the selection
end tell
repeat with i from 1 to the count of these_items
set this_item to (itemi of these_items) as alias
set this_info to info forthis_item
set oldfolder to name of this_info
set newfolder to replaceText(oldfolder, SS, RS)
set name of this_info to newfolder
end repeat