I need to get path of all files in folder x (which has lots of sub-folders), which are modified after time z and are type of app, scpt, scptd, applescript.
I tried to drill thru all folders but it was very slow. Can i do this using Spotlight?
I need to get path of all files in folder x (which has lots of sub-folders), which are modified after time z and are type of app, scpt, scptd, applescript.
I tried to drill thru all folders but it was very slow. Can i do this using Spotlight?
For sure you want to use spotlight. That’s the fastest. You’ll want to use the unix command line utilities mdfind and mdls. Look at their man pages. Have you searched the forums for spotlight? I’m sure you’ll find lots of scripts. Also you can see a tutorial on mdfind here.
Edit:
to find a App it could be better to use “kMDItemFSName” instead of “kMDItemDisplayName” as the extension of an App is hidden by default … haven’t tested this change …
Hi,
nice mix, but it “seems” to work → hopefully …
set StartTime to "12:00:00" --the daily time to start the search from ...
set ThePath to quoted form of POSIX path of (path to desktop) --Your Folderpath
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to " "
set x to every text item of ((current date) as text)
set StartDate to ((text items 1 thru 4 of x) & StartTime & (text item -1 of x)) as text
set StartDateAsReal to ((current date) - (date StartDate)) / 86400
set TheResultString to ""
set TheSearchList to {".scpt", ".psd"}
repeat with i from 1 to count of TheSearchList
set theSearch to item i of TheSearchList
set theResult to (do shell script "mdfind -onlyin " & ThePath & " 'kMDItemDisplayName == \"*" & theSearch & "*\"&& kMDItemContentModificationDate >= $time.today(-" & StartDateAsReal & ")'")
set TheResultString to TheResultString & return & theResult
end repeat
set AppleScript's text item delimiters to return
set TheResultList to paragraphs 2 thru -1 of TheResultString
set AppleScript's text item delimiters to tid