Nestorito wrote: ↑Fri Sep 07, 2018 5:25 am
Hi zvh,
if I understand correctly your script should output a list of files that are not associated to references in an open BE database, am I right? So basically it could be used to "clean" the BE attachments folder from old or unassociated files, right?
In my BE attachments folder I have also powerpoint files and other kind of files, how can I tell your script to consider also this files as attachments?
After this how can I tell the script to output the list in a text file to later compare it with the attachments folder files?
Thanks a lot
Nestor
Hi Nestor,
Yes, this script takes a list of the names of the files within a certain folder (and its subfolders) and compares it against the list of the names of the attachments indexed in your open Bookends library. It then creates a new list of anything in the folder that isn't indexed by Bookends (whether because it has no record in Bookends or because the name of the file is different and therefore incorrectly indexed, etc.).
As per (2) in my initial post, if you run the script above then it should automatically include all file types except for skimnote files, which I've excluded near the bottom of the script. Altering that line would allow you to include (or exclude) files with the powerpoint extension or any other kind of extension. If you simply leave it as is, however, it should include powerpoints alongside pdfs, epubs, and so on.
There are a couple of options in terms of getting the output of the script. Changing the line
to
would set your clipboard to the list. To write to a file, you could instead change the line to
Code: Select all
do shell script "echo " & quoted form of textList & " > /path/to/your/file"
Note that, if you have spaces in your path, you need to escape them like so
Code: Select all
/Users/Nobody/My\ Library/This\ List.txt
There is also a way to write to a file without invoking the shell, but it involves opening the file with write permission, so I think this way might be a bit easier to implement.
Hope this helps!