List manipulation - Help please

Hello All,

I need some assistance in manipulating the List.

I have a list with file paths, pointing to file in “old image” folder. I have to create another list pointing to another file in “New image” folder. I have no clues on how to handle this. Your advise will be much appreciated.

Point to Note:
a) Folder name “Old Image” should be changed to “New Image”
b) End of File name “_Old” should be changed to “_New”

set theOldPath to {“/Users/john/Desktop/old image/S0085275_Old.eps”, “/Users/john/Desktop/old image/S0085274_Old.eps”, “/Users/john/Desktop/old image/S0085273_Old.eps”}

Would like to get another new list something like:
set theNewPath to {“/Users/john/Desktop/New image/S0085275_New.eps”, “/Users/john/Desktop/New image/S0085274_New.eps”, “/Users/john/Desktop/New image/S0085273_New.eps”}

Thanks in advance

Hi,

there are several ways to accomplish this, the easiest is using text item delimites


set theOldPath to {"/Users/john/Desktop/old image/S0085275_Old.eps", "/Users/john/Desktop/old image/S0085274_Old.eps", "/Users/john/Desktop/old image/S0085273_Old.eps"}
set theNewPath to {}

set TID to text item delimiters
repeat with onePath in theOldPath
	set text item delimiters to "old image"
	set onePath to text items of onePath
	set text item delimiters to "New image"
	set onePath to onePath as text
	set text item delimiters to "Old"
	set onePath to text items of onePath
	set text item delimiters to "New"
	set end of theNewPath to onePath as text
end repeat
set text item delimiters to TID
theNewPath

You Rock Stefan :smiley:

Thanks a Million. Exact solution what i am looking for.

Rgds
JaiM