hi,
i would like to add a string to each filename in a folder i.e
start-
myfolder:
fileone.jpg
filetwo.jpg
filethree.jpg
result-
myfolder:
textfileone.jpg
textfiletwo.jpg
textfilethree.jpg
i’am a total beginner to applescript, i’ve seen scripts which will do this and much more but i’d like something really basic so i can understand how it works.
thanks alot, mark.
This should do the trick:
set picfolder to choose folder
set the_path to (picfolder) as string
set all_items to list folder picfolder without invisibles
repeat with each_item in all_items
[color=blue]set[/color] [color=green]each_item[/color] [color=blue]to[/color] [color=blue]alias[/color] ([color=green]the_path[/color] & [color=green]each_item[/color])
[color=blue]tell[/color] [color=blue]application[/color] "Finder"
[color=blue]set[/color] [color=green]old_name[/color] [color=blue]to[/color] [color=blue]name[/color] [color=blue]of[/color] [color=green]each_item[/color]
[color=blue]set[/color] [color=green]new_name[/color] [color=blue]to[/color] "textfile" & [color=green]old_name[/color]
[color=blue]set[/color] [color=blue]name[/color] [color=blue]of[/color] [color=green]each_item[/color] [color=blue]to[/color] [color=green]new_name[/color] --[color=olive]rename the file[/color]
[color=blue]end[/color] [color=blue]tell[/color]
end repeat
–this script was automatically tagged for
–color coded syntax by Script to Markup Code
–written by Jonathan Nathan
thanks very much, exactly what i wanted!