-------------------------------------------------------------------------------------------
# REQUIRES the Satimage.osax!!!!
-------------------------------------------------------------------------------------------
set srcFolder to alias ((path to home folder as text) & "test_directory:png.image.test:")
set fileList to list files srcFolder as alias of extension {"png", "PNG"}
tell application "Finder"
repeat with theFile in fileList
set parentFolderName to name of theFile's parent
set theFileName to name of theFile
set newFileName to cng(
"^(.+)(\\.png)$", (
"\\1" &
" - " &
parentFolderName &
"\\2"),
theFileName)
of me set name of theFile to newFileName
end repeat
end tell
-------------------------------------------------------------------------------------------
--ยป HANDLERS
-------------------------------------------------------------------------------------------
on cng(_find, _replace, _data)
change _find into _replace in _data with regexp without case sensitive
end cng
-------------------------------------------------------------------------------------------