i have found that when you rename files within a folder the item index
changes (i guess because it has been modified...?)
when i want to rename files i have found the most secure way is to
move them to another folder as you rename them and always work on file
index 1 of the jobname folder.
someone else please let us both know a better way to do this..
Don't iterate by index, iterate over every item:
tell application "Finder"
get every item of folder "ABC" of desktop
repeat with x in result
set name of x to "ABC-" & name of x
end repeat
end tell
-- Steve Majewski
On Oct 18, 2004, at 8:07 PM, Holger Pleus wrote:
Did i send this? I'm not sure. maybe there's some confusion with an
outdated E-Mail-account and a forwardint to it. So please excuse me
if it was double-sent.
Given a folders name (Jobname) is "123" and the items in the folder
are
{"01", "02", "Bilder", "Korrekturabzug", "Vorlagen"}
from the following code i get
{"02", "123-123-01", "123-Bilder", "123-Korrekturabzug",
"123-Vorlagen"}.
What did i do wrong?
Holger
code:
set theFolder to folder Jobname of desktop
repeat with i from 1 to count of items in theFolder
set theItem to item i of theFolder
set OldItemName to name of theItem
set NewItemName to Jobname & "-" & OldItemName
set name of theItem to NewItemName
end repeat