Re: Get every file of the entire contents of a folder. Quickly.
Re: Get every file of the entire contents of a folder. Quickly.
- Subject: Re: Get every file of the entire contents of a folder. Quickly.
- From: kai <email@hidden>
- Date: Tue, 14 Oct 2003 07:44:10 +0100
on 14/10/03 6:57 am, I wrote:
>
on EveryFileOfFolder(p)...
Come to think of it - I could have cleaned that up a bit better:
--=======================
on EveryFileOfFolder(p)
set termExists to p's class is list
if termExists then
set folderAlias to p's item 1
set searchterm to p's item 2
else
set folderAlias to p
end if
set folderPath to quoted form of (POSIX path of folderAlias)
set shellFind to "find " & folderPath & " ! -name '\\.*' -type f | tr -s
'//' | tr '/' ':'"
if termExists then set shellFind to shellFind & " | grep " & searchterm
try
set filelist to paragraphs of (do shell script shellFind)
on error
return {}
end try
set prevDelim to text item delimiters
set text item delimiters to ":"
set DiskName to return & text item 1 of (folderAlias as Unicode text)
set text item delimiters to DiskName
set filelist to rest of (DiskName & (filelist as Unicode text))'s
paragraphs
set text item delimiters to prevDelim
filelist
end EveryFileOfFolder
--=======================
---
kai
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.