Monday, September 30, 2013

Get log file from latest folder through AppleScript !

#This AppleScript is for get latest log file generated during automatic build server.

set sourceFolder to "Users:....:.....:targetFolder"

property the_path : "/Users/..../.../targetFolder"
set theFolder to (POSIX file the_pathas alias

tell application "Finder"
set itemGroup to sort (get every folder of theFolderby creation date
set LatestFolder to (get first item of itemGroup)
set LatestFolderName to LatestFolder's name
end tell

set latestFilePath to "/Users/..../..../targetFolder/" & LatestFolderName & "/log"


#This AppleScript is for get latest folder and it's name.


set sourceFolder to "Users:....:.....:targetFolder"

property the_path : "/Users/..../.../targetFolder"
set theFolder to (POSIX file the_pathas alias

tell application "Finder"
set itemGroup to sort (get every folder of theFolderby creation date
set LatestFolder to (get first item of itemGroup)
set LatestFolderName to LatestFolder's name
end tell