referencing invisible items in the Finder (9.1)
referencing invisible items in the Finder (9.1)
- Subject: referencing invisible items in the Finder (9.1)
- From: David Thorp <email@hidden>
- Date: Mon, 04 Jun 2001 10:41:24 +1000
Greetings all,
Once again, thanks to all who have helped me in the past with some
questions. I have another which I am struggling to find the answer to. Any
help on this one will be greatly appreciated.
How do I reference invisible items in the Finder???
I am writing a backup script, based on the concept of doing a one way
synchronise - ie. compare two folders and backup only the changes since the
last backup. This script is meant to compare the contents of two folders, a
master folder and a backup folder, and then:
(1) delete anything in the backup folder that's not in the master folder,
(2) copy anything in the master folder that's not in the backup folder,
(3) replace anything in the backup folder that is in the master folder but
is older in the backup folder.
But when I "list folder ..." I get a list of all the items, including the
invisible ones, but then when I try to reference them, it gives me an error
saying that it can't find the file.
Here's the part of the script that is causing me the problem:
on dobackup(masterfolder, backupfolder)
tell application "Finder"
set mastercontents to list folder masterfolder
set backupcontents to list folder backupfolder
-- this loop does (1) above.
repeat with backupitem in backupcontents
if backupitem is not in mastercontents then
delete (alias ((backupfolder as text) & backupitem))
end if
end repeat
-- then in here is a loop that does (2) and (3) above
...
end tell
end dobackup
The "list folder" command seems to list the names of all the items in the
folder, including the invisible ones - which is exactly what i want.
But the "delete alias ..." command doesn't seem to be able to see invisible
items and gives me this error: "Finder got an error: Can't get alias '...'"
(and then refers to the first invisible file in the backupfolder).
I've been through the standard editions dictionary and the finder
dictionary, and there doesn't seem to be any way that I can find to delete,
or copy, invisible items. Even if there was any way to reference an
invisible item, make it visible, then delete or copy it then make it
invisible again would be ok (although not ideal) but it seems that there is
just no way to get an invisible item in the finder to do anything to it.
I'm sure this can't be a new issue. Seems like a simple concept to me.
Does anyone have any ideas on this one please?
Thanks in advance for any help offered.
David Thorp,
Sydney, Australia.
------------------------------------------------------------------------
David Thorp email@hidden
------------------------------------------------------------------------
"Before you criticise someone, you should walk a mile in their shoes.
That way, when you criticise them, you're a mile away... and you have
their shoes."
------------------------------------------------------------------------