Manage FileCollections by Scripting-API (create, delete, get, add, remove items)

Hello! o)

Is it correct? We cannot create, delete, update file collections from scripting yet, right?

There is the quite dusty approach with dopusrt.exe though:
https://docs.dopus.com/doku.php?id=reference:dopusrt_reference:external_manipulation_of_file_collections

But the dopusrt.exe way does not allow to iterate over items in the file collection, is there a way I overlook right now to do this? Maybe just GO to "coll://Find Results/" and handle the collection like any other folder content? That would need a source tab though, which is not exactly what I am looking for.

I was hoping to find some factory object to create a new file collection, which then has delete(), addItem(), deleteItem(), getItems() etc. methods or even an object FileCollectionItem with delete(), updatePath()?etc. and which could also be used to be moved around existing FileCollection objects.

I was trying to import the "nice" CSV we can export, when dealing with error items from doing "unattended mode". I must say I'm still baffled, that there is no way to get all the failed items into a file collection, which would be quite an obvious thing to do? o)

No offense and thank you! o)

You can create them with CreateFolder and manipulate them with Copy and Delete. You'll find all kinds of examples on the forum.

CreateFolder? Okay! o)

Yes, I have seen a Delete FROMCOLLECTION or something similar here, but this screams for a new cleaned up API of some kind, doesn't it? Calling various native commands is also probably slow for bigger collections, not sure (just trying to find arguments! o). We could make good use of some wrapper object at least, to concentrate all the FileCollection manipulation stuff into a single place, this could be done in JS as well I guess.

But iterating over the items in the collection is still not possible, or do you have a suggestion here as well?

Thank! o)

fsu.ReadDir() is ready for action :slight_smile:

Have a look at MergeFolders and WslFind.

Mhh, I don't know how the linked script addins help iterating over items in a file collection.

FSUtil.ReadDir() lets you read the contents of any folder including collections.

Ah, ok, now I get it! o)

Sorry, I somehow did not make a connection between ReadDir() and file collections, not taking into account the multiple things these various methods can do.

Thanks everyone! o)