Exporting folder listing

I know that I can print a folder listing by selecting all of the folder contents and then option moving the list to the printer icon.

How can I effectively export a folder list in a format that Excel can recognise? I need to create a chronology before importing it into Filemaker.

For starters, I’d suggest going to the script menu, More Scripts… And install Export Metadata as CSV.

Many thanks Alan.

Is it possible to amend the script to also pick up the date?

Yes, it is. Here’s a modified version that adds the modification date of the record to the output. It also changes the delimiter from semicolon to comma.

To store it, unzip the file to get an scpt file, go into the script menu, click Open Scripts Menu, and store this file in the export directory.
Export Metadata as CSV.scpt.zip (8.38 KB)

Many thanks Alan.

Thanks for doing that, Alan. I’d suggest using the semicolon delimiter to avoid those situations where Name or Comment contains commas. For documents that originated as clippings from web pages, it is not uncommon to have commas in names. And of course people use commas in comments frequently.

It’s all quoted so it should be fine, unless you use something that doesn’t support quoted CSVs (mostly AWK, all the spreadsheet apps should be ok).

I switched it to commas since in the US locale, Numbers won’t correctly load a semicolon-delimited file.

Ideally, the script would let you select the delimiter, and select the columns… But that will wait until I have more free time.

Alan very kindly provided a script for exporting a folder listing modified to include the date.

What further modifications are required to pick up the other data in the display window such as file type, author and recipient?

I was trying to run this script on a group I have for a chronology of events.

When I select all records in the group and run the script, I get a message “Can’t get of missing value”.

If I run the script on records individually, some get exported; others just generate the same dialog as above. I don’t know what it is about the individual records that is different.

I don’t know what class DTpl is or what value it is looking for?

“DTpl” is the plain text version of the contents of a document – and that class is used in a case in the script where the code finds an “x-devonthink-item” link in the URL field of another document, assumes that the URL links to an annotation record, and then attempts to find the plain text of that annotation. (One of the columns of output in the CSV is the content of any annotations that a document contains.) What happens when the script fails is that there is no annotation document – the script attempts to follow the “x-devonthink-item” URL, doesn’t find it, and instead of stopping it attempts to access the text of a document that doesn’t exist, and then crashes.

One of the authors above will need to modify this code section so that the script doesn’t abend when it fails to locate a linked document:

if this_URL is not "" then
				set this_annotation to plain text of (get record with uuid this_URL)
				set this_annotation to ""
			end if

For you, if you look to find a document that has an “x-devonthink-url” that does not point to an actual linked document, and remove the URL, you should be able to run the script. Be aware you might have more than one case that has a bad URL.