Re: move folder & copy image ? (newbie)
Re: move folder & copy image ? (newbie)
- Subject: Re: move folder & copy image ? (newbie)
- From: Michelle Steiner <email@hidden>
- Date: Mon, 6 Aug 2001 17:17:12 -0700
On 8/6/01 4:30 PM, T. Breheny / DiGiTAL ZEN <email@hidden> wrote:
>
is there an AS equivalent to: "../" used to navigate up a directory? my
>
problem is i won't know the name of that directory as it will change each
>
iteration. i've looked through the document "AS Finder Guide" but don't see
>
anything. i need to select all the files in a folder and have them moved to
>
the parent folder.
>
>
any advice much appreciated.
This will give you the parent folder of a selected item:
tell application "Finder"
set the filePath to item 1 of the selection
end tell
set the FolderString to the filePath as text
set {tid, text item delimiters} to {text item delimiters, {":"}}
set the parentFolder to my whatlevel(FolderString, 1)
set text item delimiters to {""}
parentFolder
on whatlevel(pathname, howfar)
return text items 1 through -(howfar + 1) of pathname as text
end whatlevel
For the grandparent, use 2 instead of 1; for the great grandparent, use
3; etc. You would have to add error trapping to make sure you don't get
a non-existent ancestor generation, of course.
--Michelle
----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spiritual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------