• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Renaming files in list in batch
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Renaming files in list in batch


  • Subject: Re: Renaming files in list in batch
  • From: Nathan Day <email@hidden>
  • Date: Fri, 23 Aug 2002 01:54:09 +0930

I'm doing a similar thing in an AppleScripts Studio project I'm working on, and this is what I do within an tell block to finder

set theName to name of theItem
set theNewName to theName
set theCount to 2

repeat while item theNewName of aDestination exists
tell me to set theNewName to (newName by (space & theCount) onto theName)
set theCount to theCount + 1
end repeat

move theItem to aDestination without replacing

I also move the file first to a temp folder then rename it and then move it to the destination this is so you don't run into problems with trying to rename the file to a name that matches a file in the source folder. You can get a temp location with.

set theTempFoler to path to temporary items

anything in there gets deleted eventually.

On Friday, August 23, 2002, at 12:29 AM, Helen Muller wrote:

Hello,

Can someone help me. please? I am writing a script which moves just the
files (in a list in batch) I want to from one folder to another. That part
goes right. But now I want to change the filename if that filename already
exists in the other folder. The user sends the file to Folder A, applescript
moves the file from Folder A to Folder B. For example;

In folder A I have
test1.ps (is deleted after moving it to folder B)

In folder B I have
test1.ps

If the user sends another file named test1.ps I want Applescript to rename
it automatically to test1_1.ps. Because of my workflow I create the
following situation:

In folder A I have

In folder B I have
test1.ps
test1_1.ps

That part I still can handle. But if the user sends another file named
test1.ps I get an message; filename already excists. Overwrite file
(Yes/No). I don't want the message I want the file to rename automatically
if the system notices that a file with the same name allready excists. For
example;
test1_1.ps, test1_2.ps, test1_3.ps, et cetera.

Best Regards,
Helen Muller
PeereboomKoggeschip
The Netherlands
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

Nathan Day
http://homepage.mac.com/nathan_day/
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Renaming files in list in batch (From: Helen Muller <email@hidden>)

  • Prev by Date: Re: Clarification (was: Re: AppleScript and international characters)
  • Next by Date: Change the mod result in list
  • Previous by thread: Renaming files in list in batch
  • Next by thread: Change the mod result in list
  • Index(es):
    • Date
    • Thread