Re: File name manipulation
Re: File name manipulation
- Subject: Re: File name manipulation
- From: Walter Ian Kaye <email@hidden>
- Date: Sat, 27 Dec 2003 17:58:19 -0800
At 08:23p -0500 12/27/2003, Graff didst inscribe upon an electronic papyrus:
This will swap around the name as you have requested. I'm not sure
of how to go about changing under what application the file
automatically opens in:
That part's easy...
------------
set theFolder to choose folder
set oldDelims to text item delimiters
tell application "Finder"
set theList to every file in theFolder
repeat with currItem in theList
set creator type of currItem to "sfri" --tight binding!
try
set theName to the name of currItem
set theExtension to ""
try
set AppleScript's text item delimiters to "."
set plainName to text item 1 of theName
set theExtension to text item 2 of theName
end try
if theExtension is "" then
set plainName to theName
end if
set AppleScript's text item delimiters to "_"
set firstElement to text item 1 of plainName
set secondElement to text item 2 of plainName
set nameString to secondElement & "_" & firstElement
if theExtension is not "" then
set nameString to nameString & "." & theExtension
end if
set (name of currItem) to nameString
end try
end repeat
end tell
set text item delimiters to oldDelims
------------
- Ken
On Dec 27, 2003, at 7:32 PM, Rob Lewis wrote:
I have a folder with over 500 files in it. The file names are of the form:
Item_Topic.html
I would like a script to change the files names to:
Topic_Item.html
(just interchange the text on either side of the underscore and
before the suffix).
While I'm at it, I'd like to change the "open with" parameter from
Internet Explorer to Safari.
_______________________________________________
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.