Similar to Finder’s “entire contents” (return a list of ALL items within given directory), but this one is a bit more robust and returns a list of aliases instead of Finder file references.
OS version: OS X
(*
entireContentsOf
Returns an alias list of all items within a folder or disk.
Under some circumstances, it may be quicker than Finder's "entire contents" property; and, anyway, it returns a list of aliases, which is more useful usually than Finder's references. Also, at least in my computer, the Finder drops some times memory errors in folders with large contents.
Parameters:
dir: file path, alias, posix path to a directory (if provided list of paths, returns list of lists of aliases)
Example:
entireContentsOf("path:to:folder:") --> {alias "path:to:folder:foo.txt", alias "path:to:folder:foo2.txt"}
*)
to entireContentsOf(dir)
script blank --> auto-contain all needed stuff
to aliasize(argos)
script foo
property itemsList : argos
end script
set k3 to {}
repeat with i from 1 to count itemsList of foo
try
set k3's end to alias (item i of foo's itemsList as POSIX file as text)
on error
set k3's end to alias ((item i of foo's itemsList as POSIX file as text) & return)
end try
end repeat
return k3
end aliasize
end script
if class of dir is not list then set dir to dir as list
set output to {}
repeat with f in dir
set f to f as Unicode text
if f does not contain ":" then set f to POSIX file f as Unicode text
set end of output to blank's aliasize(paragraphs of (do shell script "find " & quoted form of POSIX path of f & "*"))
end repeat
if (count output) is 1 then
return output's item 1's contents
else
return output
end if
end entireContentsOf
property |version| : 1.0
property |from| : "jfileLib"
property author : "Pescados Software · PescadosWeb.com"
property |date| : date "jueves, 15 julio 2004 00:00:00"
property license : "freeware, open-source"