I want to set the file and creator for all the files in the folder TEMP and all it’s sub-folders. I keep getting an error “Can’t set «class fcrt» of “U” to “CER3”.” Even if i get past this error, I’m sure this will do what I need it to. HELP!!! :mad:
property fileType : "DIAT"
property creatorType : "CER3"
set MyPath to "Users:shaun:Downloads:TEMP:"
tell application "Finder"
activate
set theseFolderItems to every item in MyPath
repeat with theItem in theseFolderItems
set the creator type of theItem to creatorType
set file type of theItem to fileType
end repeat
end tell
I think you are looking for entire contents of and files of. Try:
property fileType : "DIAT"
property creatorType : "CER3"
set MyPath to "Users:shaun:Downloads:TEMP:"
tell application "Finder"
activate
set theseFolderItems to files of (entire contents of MyPath)
repeat with theItem in theseFolderItems
set the creator type of theItem to creatorType
set file type of theItem to fileType
end repeat
end tell
Your original script was trying to set the file type and creator code of the folders in the TEMP folder, which isn’t a property of folders (or containers), that is why you were getting errors. Take a look at Containers & Folders in the Finder’s Applescript dictionary.
I tried this with a choose folder dialog instead of your path text. Try this:
property fileType : "DIAT"
property creatorType : "CER3"
set MyPath to "Users:shaun:Downloads:TEMP:"
tell application "Finder"
activate
set theseFolderItems to files of (entire contents of folder MyPath)
repeat with theItem in theseFolderItems
set the creator type of theItem to creatorType
set file type of theItem to fileType
end repeat
end tell
tell application "Finder"
tell every file of entire contents of folder "Downloads:TEMP:" of home
set creator type to "CER3"
set file type to "DIAT"
end tell
end tell
If you must use HFS path strings, remember that unlike POSIX paths they must start with a disk name.