0

I'm looking for a way to get the following information via AppleScript:

  • all the information ls provides including the creation date/time of a file or folder
  • MD5 hash, Finder labels and Finder/Spotlight comments

into an output like

46737077 drwxr-xr-x 2 Jonas 68 Oct 4 15:39:34 2012 /Users/Jonas/Desktop/test/test.txt 5 md5_here finder_comment_here

What I currently have is some old code which needs tweaking (creation date/time is missing):

do shell script "find -x " & my_path & " -print0 | xargs -0 ls -d -F -P -l -T -a -e -i -o -p -q " & my_path user name "user" password "pin" with administrator privileges

and some basic looping code for the comments/labels

set results_list to "/Users/Jonas/Desktop/test1.txt /Users/Jonas/Desktop/test2.txt"
set comm to {}  
set labels to {}  
repeat with counter from 1 to count paragraphs in results_list  
    tell application "Finder" to set end of comm to comment of item ((POSIX file (paragraph counter in results_list)) as string)  
    tell application "Finder" to set end of labels to label index of item ((POSIX file (paragraph counter in results_list)) as string)  
end repeat  

but now I'm kind of stuck in combining this all together.

3
  • 1
    Looks unnecessarily convoluted to me. Why don't you use ls with the parameters you need and pipe it to a text file? Mar 24, 2013 at 6:27
  • @clueless5 As asked the question leaves a rather narrow room for an answer and the risk is that no answer is possible. To improve the question, could you take one step back from the old code and list the things you want to know about each file and what you want to do with it afterwards? This would make it much easier for anybody to find OS X specific answers.
    – nohillside
    Mar 24, 2013 at 9:06
  • @clueless5 I did some heavy editing to combine the additional information you provided with the original question. Please revise and edit where you see fit and also check whether I've missed something.
    – nohillside
    Mar 24, 2013 at 15:59

1 Answer 1

1

I am not sure if you need to have it in this particular way, but why not simply using something like

ls -l > logfile.txt

and add the necessary options to ls if you want it a little bit more specific

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .