How can i import files from a text file into a collection?

This is the command i use:

C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe/col import /utf8 "coll://neuImp" {f}

I think it worked a long time ago. I have the .txt file marked on one side, and the collection coll://neuImp (which is empty) open on the other side. Yet i get some error message

"C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe/col import /utf8 "coll://neuImp" "L:Box\Box Sync\NeuImp.txt" couldn't be found"

Any help appreciated.

You should put quotes around paths that contain spaces, and you also have no space between the name of the exe and the first argument.

"C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" /col import /utf8 "coll://neuImp" {f}

Like how? I need the very precise command, since i am very much too stupid to grasp the right command? All i get is no success.

I gave the fixed command line in my post.

Sorry, but i m one of those every very stupid persons, who needs a literally comment to solve this problem I do not understand what you are talking about. Please give me a an exact code of what to do.

I don't understand. The code is already in my first reply.

Have you tried the command from that post?

If it still doesn't work, it must at least fail in a different way, as it would not generate the same error message as your original command. If it's still not working, tell us the details.

Thanks Leo. I have overlooked the quotes. Would it be possible to create a collection, based on the current text file, instead of always using "NeuImp"? For example, when the text file is called "Sommer 2021", the code would create a collection by that name.

You can use {file$|noext} to insert the name (without path or extension) of the selected file into the command.

"C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" /col import /utf8 "coll://{file$|noext}" {filepath$}

(I also changed the {f} at the end to the longer version {filepath$} which does the same thing but is easier to understand, and added the $ to make it not run anything if no file is selected.)

1 Like

Thank you, Leo, almost perfect. How would i create a folder of that same name in coll:// prior to your command? So, for instance, if the text file is named Test01, the code would create a new collection by that name, and then import the contents. I have played around with {file$}, but can't figure it out how to achieve it.

I think it should create the collection automatically (at least if there isn't an error opening the text file etc.). I'd be surprised if it doesn't, at least. Have not double-checked, though.

In any case, you can use a command like this to create a collection:

CreateFolder READAUTO=NO NAME="coll://{file$|noext}"

So this will create a collection and then add the file list to it:

CreateFolder READAUTO=NO NAME coll://{file$|noext}
dopusrt /col import /utf8 coll://{file$|noext} {filepath$}

(I realised we must be running this from an Opus button/hotkey/etc., so we can use dopusrt on its own as a shortcut, to avoid specifying the full exe path. Also removed some quotes that aren't needed as they'll be added by the {file$|noext} code automatically when needed. But the only real change, compared to before, is adding the CreateFolder line.)

1 Like

Great work, Leo, as always. It works now as intended. However, for some reason the older code wouldn't create that folder. And yes, i'm using both, a button and a shortcut. I have also added Go Coll:// openindest which works fine. Thanks a lot!

1 Like

Oh, looking at the docs, the import command has a /create switch which makes it create the collection if it doesn't already exist.

So you can do everything in one line again:

dopusrt /col import /create /utf8 coll://{file$|noext} {filepath$}

If you need it, there's also a /clear switch to clear out any existing collection before importing the list.

1 Like

Thanks, i will give that alternative a try. Regarding the /clear switch, i suppose i would have to add it right before the /create switch, like so:

dopusrt /col import /clear /create /utf8 coll://{file$|noext} {filepath$}

That looks right

1 Like