How to expose files to Mac and Finder?

What is the best way to make files accessible by the Finder?

I need to process thousands of files (change filenames, extract content from files with a bunch of Python scripts without changing their content). And to do that I need to make the files that are in DT visible outside DT.

This is how I would like to do it:

  • In Finder: Create a folder (called “EXPOSED”)
  • In DT: Replicate the files I need to change into that folder
  • In Finder: Do my changes
  • In DT: Remove replicates from that folder

Of course I could copy all files out of DT, do my changes and import them back into DT. But I assume in that case I’d loose the Item ID in DEVONthink, and DT would treat them as new entries?

  • Create a folder (called “EXPOSED”)
  • Replicate the files I need to change into that folder

Creating and replicating where - in the Finder or DEVONthink?

Of course I could copy all files out of DT, do my changes and import them back into DT. But I assume in that case I’d loose the Item ID in DEVONthink, and DT would treat them as new entries?

You could export the files via File > Export > Files and Folders to a newly created folder on your Desktop. However, yes they would receive new UUIDs when using File > Import > Files and Folders.

I’d create the folder in the Finder, then index that folder from DT, finally replicate the files that I need to access from Finder into that folder. Doing these steps should create a folder for sharing files between DT and the Finder, no?

I don’t want to use the UUID.

finally replicate the files that I need to access from Finder into that folder.

replicate has a very specific meaning in DEVONthink and not what you seem to be referring to. You’d copy or export them.

Exporting to a Finder folder and indexing the folder will allow you to mess about with the files outside DEVONthink.

Does replicating not create a sort of “symlink”? A pointer to the original file in DT?

I could also move the files to that “shared” group to make them visible to the Finder, and then move them back to their original place.

Is there no way to expose files to the Finder without practically “removing them” from DT first?

Update: Just tried without success

  • Created a folder in Finder
  • indexed in DT
  • replicated a file in DT into that Group

Now I cannot see that replicated item in Finder.

So there is no way for exposing a file without losing all prior metadata in DT (it’s UUID and associated data).

Does replicating not create a sort of “symlink”? A pointer to the original file in DT?

No. A replicant is more similar to hardlinks, not symlinks.

  • indexed in DT
  • replicated a file in DT into that Group

Now I cannot see that replicated item in Finder.

No. You can’t replicate to the Finder.
Also, a replicant is an instance of a file. If that file is imported, the replicant will be imported.

You could Control-click the file in the indexed group and choose Move to External Folder.

Why are you trying to replicate the files into the indexed group anyways? Are they in disparate locations in the database?

Because that was the way I tried to keep the items in DT but make them visible for changes from outside of DT.

Actually what I want is to programmatically access the content. I could not find an API for doing that. And completely moving the files out of DT and then importing them back are no option because that invalidates previous links to those items.

There are at least three APIs for accessing file’s content from DT3 that I’m aware of: AppleScript, JavaScript and Objective C. My personal preference (!) is JavaScript. You might move this question to the Automation sub forum, where you’ll find some examples for scripts.

Since you already seem to have some python scripts, you could, for example, try to pipe the contents of your file to a Python script from AppleScript (I suppose it’s possible with JS, too, but I don’t know yet how).

Alternatively, you could do the text processing inside DT3 using JS (or AppleScript, if you’re so inclined).

I also found this link
https://wiki.python.org/moin/AppsWithPythonScripting
but don’t know if it’s any help

1 Like

I want to use this type of workflow to send files to android phone. For example I want to tag the item with “phone” tag, then with a smart rule, I want to replicate the item to indexed folder that is in the dropbox folder. Then I read the file on my phone and after that, I remove the tag in DT3. So, I can have my annotations that I have made on my phone in DT3.
But as you said, the replicate doesn’t work for indexed folders. So is there another way to do that?