Array - List of file attributes

I’m looking for a way…

When a folder is opened via script/filemaker(easy) to read the files’ in the folder and return an array of files’ information.
name, date created, modification date and time, that sort of thing. (hopefully this can be as exhaustive as possible, never too much data :lol:)

I want to bring these into filemaker so that a workflow can be triggered based on a files arrival.
Not knowing the filename, I will have to react when a new file arrives so I will also be doing a file count and trigger based on newfilcnt=filecnt+1.

thanks

A

Here’s an example of how yu could do it:

tell application "Finder"
	set {myname, myCreationdate, myModifieddate} to {name, creation date, modification date} of (choose file)
	display dialog "Name: " & myname & return & "Creation Date: " & myCreationdate & return & "Modified Date: " & myModifieddate
end tell

If you want more info - run this script and you’ll see what other typres of info is available for a file.

get info for (choose file)

hope this helps…
Chris

Thanks for that I’ll see where it takes me.

Hi Guys,

This is pretty cool and has got me thinking and trying to modify it so that it will get the info of every file in a directory and save it as a text file on the desktop…Unfortunately I don’t have the experience needed.

Any help?

Thanks in advance,

Duke

Kai’s “Show ‘info for’ properties in a text document” script will be a great help here. It just needs a minor change (path to desktop) and a different input (list of all the files in a folder) to make it work the way you want it to:

on get_text(i)
	try
		i of {i}
	on error i
	end try
	set text item delimiters to "{"
	set i to i's text from text item 2 to end
	set text item delimiters to "}"
	i's text 1 thru text item -2
end get_text

on text_list(r)
	set l to r as list
	set r to text 2 thru -2 of get_text(r)
	repeat with i from 1 to (count l) - 1
		set d to get_text(l's item i)
		set text item delimiters to d & ", "
		set l's item i to r's text item 1 & d
		set r to r's text from text item 2 to end
	end repeat
	set l's item -1 to r
	l & ""
end text_list

to write_file(t)
	set p to (path to desktop as Unicode text) & "info for.txt"
	set f to open for access file p with write permission
	set eof f to 0
	write t to f
	close access f
	tell application "TextEdit"
		activate
		open p
	end tell
end write_file

to open l
	set l's item 1 to text_list(run script ("info for alias \"" & l's item 1 & "\""))
	repeat with i from 2 to count l
		set l's item i to text_list(info for l's item i)
	end repeat
	set text item delimiters to return
	set t to l as Unicode text
	set text item delimiters to {""}
	write_file(t's text 1 thru -2)
end open

on run
	choose folder
	tell application "Finder" to get (files of result) as alias list
	open result
end run

Thanks Bruce,

That is brilliant and does just what I need.:lol:

Keep coding,

Duke.

Glad you flagged that, Bruce. I noticed that, in the explanation given in message #5, some codes from the Classes and constants demonstration had somehow become corrupted (so scriptee no workee). All fixed up now. :slight_smile:

Glad I could help. :slight_smile: