Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with file renaming



The index is probably based on sorting the names. When you changed the first file name, you changed its index to 2 inadvertantly, so it got renamed twice.

Try this. Note the alternate way of iterating the list:

set theFolder to folder Jobname of desktop
set fileslist to every item in theFolder
repeat with theItem in fileslist
set OldItemName to name of theItem
set NewItemName to Jobname & "-" & OldItemName
set name of theItem to NewItemName
end repeat


end code



On Oct 18, 2004, at 1:33 PM, waynemelrose wrote:

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..



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

end code

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/ email@hidden


This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/ email@hidden


This email sent to email@hidden


--
David Durkee
email@hidden
<http://ddurkee.homeip.net/>

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden
References: 
 >Problems with file renaming (From: Holger Pleus <email@hidden>)
 >Re: Problems with file renaming (From: waynemelrose <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.