Re: Creating folders (directories) without the Finder
Re: Creating folders (directories) without the Finder
- Subject: Re: Creating folders (directories) without the Finder
- From: Richard 23 <email@hidden>
- Date: Sun, 25 Mar 2001 00:54:23 -0800
>
I found your trio, and decided to create my own implementation. Here is
>
what I came up with:
>
>
Note: Replace backslash, "\", with option-L.
Replace every 3rd e with an upside down e thinggy (a schwa?)
except on alternate wednesdays when every other consanant
strung together will spell out a major international city.
This is getting silly. Here's myne.
Since you get to do '\' you'll pardon the 'tid' abbrev.
I'm experimenting with a dummy aete which replaces common
raw codes with an appropriate term. While I was in there
I couldn't resist adding an abbreviation for, well you know.
-- ---------------------------------------------------------
-- Preprocessed by Convert Script 1.0d5
-- ---------------------------------------------------------
-- author: Richard 23, date: Sunday, March 25, 2001
-- ---------------------------------------------------------
property parent: AppleScript -- there, now I can say my tids
property FF : ASCII character 255
set thePath to "Private:TestOne:TestTwo:TestThree:TestFour:"
CreateFolder(thePath)
--
-------------------------------------------------------------------------
-- CreateFolder 1.0a1 library (c) 2000-2001 by Peter Lee and Richard 23.
-- convert path string to a list of folder names, each ending with a colon
-- creates any missing folders for specified hierarchy. Fun in the sun.
--
-------------------------------------------------------------------------
on CreateFolder(thePath) -- works whether file or path specified
tell (a reference to end of my result)
set {my tids} to {":", thePath as alias as string}
set {my tids} to {":" & FF, text items}
set {my tids} to {FF, it as string}
set {my tids} to {"", text items}
set {theList, theLen} to {contents, length}
end tell
repeat with theIdx from (theLen - 1) to 1 by -1
if exists (theList's items 1 thru theIdx as string) then ==>
tell application "Finder" to ignoring application responses
repeat with theIdx from theIdx + 1 to theLen
theList's items 1 thru (theIdx - 1) as string
make folder at folder result with properties ==>
{name:theList's item theIdx}
end repeat
end ignoring
return true
end repeat
return false
end CreateFolder
-- ----------------------------------------
-- simple exists test without Finder calls
-- ----------------------------------------
on exists theItem
log {|EXISTS|:theItem}
try
theItem as alias
theItem's contents /= ""
on error
false
end try
return result
end exists
-- ---------------------------------------------------------
R23
Moment of Terror is the Beginning of Life