I’m looking for a fresh start into creating a list of filenames in a folder:
filename, # of pages, date
The files happen to be PDFs and fortunately have the number of pages listed under “More info” box of info.
I’ve gathered a number of well put together scripts from this site, but haven’t found anything that nails this exact type of list. So, I’m looking for any fresh starts before digging in- droplets, scriptlets, automator scripts…?
ABrady
Kim,
This works well. I can get the number of pages for each pdf. I don’t quite understand the script though. What’s the best way to translate this shell script in to a list (ls) sounds dumb and basic, I know, but my background in this stuff is thin.
What, for example, does kMD reference? And what is a good way to throw that onto a text doc with the file name field (and date)?
ABrady
Even if you’re a stranger to the terminal, it’s worth starting a session and typing: man mdls then hit return just to see what it does. When you’re through reading it, type q to get out of man and then quit the terminal.
this will give you the result you want but with out all the other junk
set folderName to "~/Documents/eBooks/*.pdf"
set theResult to do shell script " mdls -name kMDItemNumberOfPages " & folderName & "| sed 's/\\(kMDItemNumberOfPages\\ =\\ \\)//g' | sed ' s/pdf.*/pdf/g' | sed 's/$/,/g'"
i don’t know exactly how to get the string into a list.
An update for anyone else digging into this issue.
The kind folks at Bee Documents (http://www.beedocuments.com/software/PdfPageCount/)
have created an Automator Workflow for this. I haven’t had time to try it yet.
A.Brady