MacResource
Any AppleScript geniuses? referring to folders in folders - Printable Version

+- MacResource (https://forums.macresource.com)
+-- Forum: My Category (https://forums.macresource.com/forumdisplay.php?fid=1)
+--- Forum: Tips and Deals (https://forums.macresource.com/forumdisplay.php?fid=3)
+--- Thread: Any AppleScript geniuses? referring to folders in folders (/showthread.php?tid=54756)



Any AppleScript geniuses? referring to folders in folders - mattkime - 05-12-2008

i'm trying to write an applescript that organizes files in a hierarchy of folders. unfortunately i'm having trouble getting the subfolder of an existing folder.

the following code fails to find the folder "test" inside of thisFolder - because i'm doing something wrong.

ideas?

---

on adding folder items to thisFolder after receiving addedItems
tell finder
if exists folder "test" of thisFolder then
display dialog "yes"
else
display dialog "no"
end if
end tell
end adding folder items to


Re: Any AppleScript geniuses? referring to folders in folders - Marc Anthony - 05-13-2008

You can get subfolders by naming them, specifically, or by using "entire contents" to target them, en masse:

if exists folder "test" of thisFolder's entire contents then


Re: Any AppleScript geniuses? referring to folders in folders - MacMagus - 05-13-2008

I'm guessing that's not your actual script... it wouldn't compile.

Try using the absolute path.

if exists "drive:folder:folder2Confusedubfolder" then


Re: Any AppleScript geniuses? referring to folders in folders - Marc Anthony - 05-13-2008

I didn't notice it on my initial inspection of your code, but the Finder directive needs to read:

tell application "Finder"


Re: Any AppleScript geniuses? referring to folders in folders - mattkime - 05-13-2008

yeah, i think that was the problem, thanks!