hello, i have a script that i’m building that loops through a directory and performs backups on specific folders (parts of the name have to match, if true, backup occurs)
my problem is that the script sometimes sees files that test true to my string matching (can’t avoid that)
is there anyway to test if an ‘item’ is a file, or folder?
here’s the beginning of my script:
repeat with i from 1 to the number of items in folder designRoot
set thisItem to item i of folder designRoot
set theName to the name of thisItem
i’d love to say something like:
if (thisItem isFolder) is true then
– do my processing
end if
i’m sure there is a way to do this but i can’t figure it out, i’ve been searching for a couple of days on this one.
tell application "Finder"
set folders2backup to every folder of folder designRoot whose name contains "blah"
duplicate folders2backup to disk "backup" -- or however you're backing up
end tell
Now, folders2backup will contain just the folders whose name contain the text string, meaning you don’t need to iterate through every item.
It really depends on the class of the incoming reference, Titanium.
As it stands, the ‘info for’ command seems to handle various forms of reference, such as:
So ‘info for someVariable’ works in the case of all the above forms. However, while ‘info for file someVariable’ works fine with a file path (a), it produces an error number -43 (file not found) with an alias (b) and a file specification (c).