Problems deleting files from XSAN

Hi

I need to recurse through a master folder located on an XSAN and delete from it, and any sub folders, all files over 90 days age from creation date.
I’m using the following code which works fine when you use ‘choose folder’ but if I hard code for the XSAN it throws this error- “Can’t make every file of <> of 'XSAN:mmtest:” into type <>."

I’m a windows programmer exploring Apple world so please bare with my ignorance :slight_smile:
Appreciate any help.
cheers
Malcom

set DaysAgo to the (current date) - 90 * days
tell application “Finder”
activate
set f to (files of entire contents of (choose folder) whose creation date comes before DaysAgo) as alias list
– set f to (files of entire contents of ("XSAN:mmtest:) whose creation date comes before DaysAgo) as alias list
repeat with aFile in f
try
delete aFile
on error
display dialog “delete error, call engineering”
end try
end repeat
end tell

Browser: Firefox 2.0.0.7
Operating System: Mac OS X (10.4)

choose folder returns an AppleScript alias, not a path string.

choose folder
{class of result, result} --> { alias, alias "." }

So, if you want to use the same type of the object as choose folder returns, try replacing “XSAN:mmtest:” with alias “XSAN:mmtest:” (or “XSAN:mmtest:” as alias).

Hi malcomm,

the magic word is folder,
and the repeat loop is actually not needed


set DaysAgo to the (current date) - 90 * days
tell application "Finder"
	try
		delete (files of entire contents of folder "XSAN:mmtest:" whose creation date comes before DaysAgo)
	on error
		display dialog "delete error, call engineering"
	end try
end tell

Thanks Stefan/Chris

Solutions work a treat.
I’ll go with Stefans ideas as it simplifies things considerable.

Many thanks
Malcom