how can I speed up a folder search

G’day scripters

I’m trying to list certain date oriented files out of a very large batch of files (over 12,000).

It’s very slow,; too slow in fact.

Is there any way I can speed this up please.

Regards

Santa


tell application "Finder"
				with timeout of 1800 seconds
					set tempCycle to every folder of folder "JOBS" of disk TheServerDisk2 whose creation date ≥ MinimumDate and creation date ≤ maximumDate
				end timeout
			end tell
			repeat with x in tempCycle
				set Write_short_name to name of x
				if (count of Write_short_name) = 6 then
					 	make new menu item at the end of menu items of menu of popup button "JobsFolderList" of theWindow with properties {name:Write_short_name, title:Write_short_name, enabled:true}
						set theGlassSoundFlag to false
				end if
			end repeat

You might try mdfind. Lots of posts on how to use it here on MacScripter.

Thanks Craig.

However, i’m trying to find said folders on an unindexed Novell server disk, hence the ‘disk TheServerDisk2’.

I know stuff all about shell scripting, but was wondering if there’s a shell script that would do the job.

Regards

Santa

It’s amazing how re-programming an approach can make a difference.

My old method above took 78 seconds to find the folders in a batch of 5000+. The algorithm below takes 7 seconds, which is acceptable.

Regards

Santa


set theserverdisk2 to "Taz.vol1"
set thePath to theserverdisk2 & ":JOBS"
set cd to current date
set MinimumDate to cd - (3600 * 24 * 4) as date
set maximumDate to cd as date
tell application "Finder"
	with timeout of 180 seconds
		set tempCycle to name of every folder of folder "JOBS" of disk theserverdisk2
		set tempCycle2 to creation date of every folder of folder "JOBS" of disk theserverdisk2
	end timeout
end tell

set theList to {}
repeat with x from 1 to count of tempCycle
	if (count of item x of tempCycle) = 6 then
		set CreationDate to item x of tempCycle2
		if CreationDate ≥ MinimumDate and CreationDate ≤ maximumDate then
			set end of theList to item x of tempCycle
			set theGlassSoundFlag to false
		end if
	end if
end repeat
display dialog (current date) - cd