I'm using file collections to organise folders of images by their theme, style, etc, by grouping them into file collections and sub-collections. Some folders end up going into for example both the "cheery" and "atmospheric" sub-collections.
However, I am losing track of which folders I have already grouped into which collections and which I haven't sorted out yet. For this reason, I'm looking for a quick way to which collections my folder is in if possible.
I have tried searching for folders by their name in Find Files. But even if a result is under two collections, only one instance of it is shown, so I can't check which collection I have organised the folder under.
Using labels or status icons may work better. Status icons is the easiest if you want the option of applying more than one category to a single file. (It can also be done using normal labels, but requires a bit more work).
If you use either, you can see which categories a file has by turning on the appropriate column.
You can also then generate a file collection, if one is still needed for some other purpose, using the Find tool to look for everything with a particular label or status icon on it.
I think I still need file collections because I want to find the contents inside the folders by the category of the folders, and I don't think I can do that with labels alone unless I tag the contents as well. (Probably don't want to tag the contents manually because the contents update from time to time)
But overall, I have a lot of categories, and with branching subcategories as well, so I feel that organising them in File Collections is a lot cleaner than making lots of labels. Also, if I make labels first and generate file collections after, every time I re-label a folder, I'll probably need to update the File Collections as well, which might be a teeny bit of hassle.
Anyway, I take that getting the file collections that a member is from is impossible? I can do without it for my current usage so I'll probably stick to my current File Collections system of categorising the folders. Thanks for the quick response btw.
It's not impossible but it might be slow/inefficient if there are a lot of files in a lot of collections.
How do you do it then? I think it's fine if it's slow, since I can do with only checking a folder for its categories every now and then.
-
If the filenames are unique and it's sufficient to just check if something with the same name (not full path) is in the collection, then this is an easy way to do it:
-
If you want to check full paths, I'm not sure if there is a better way than asking Opus to export the collection data to a text file and then checking if the path is in the file.
You can ask Opus to do that via dopusrt.exe: External Manipulation of File Collections.
Thanks for all the help! Fortunately I know some Javascript and I managed to do what I needed.
My solution is pretty quick to use, except that you need to repopulate the list of collections if you change it, which is the parentArray
in the code below. I would've tried automating the getting of the fullpaths of each sub-collection in the collection tree too, but I've been too busy to read the documentation reference properly unfortunately. Also if two files have the same name, the results won't be accurate.
I'll just write the steps I took here if anyone needs this in the future.
So what I've done is
-
Exported the fullpath of every sub-collection in my collection tree to a txt file using Tools >> Print / Export Folder Listing...
-
In my text editor (I used Notepad++ and used RegEx), I deleted unwanted text and formatted each fullpath to:
"coll://collTree/collA"
, "coll://collTree/collB"
, "coll://collTree/collB/subColl"
- Added new button with following code (Customize toolbar, add new button to toolbar, change function to Script Function, and change script type to JScript)
function OnClick(clickData)
{
DOpus.ClearOutput();
var targetFiles = NamesFromClickData(clickData);
var parentArray = [
// Paste text from step 2 here
"coll://collTree/collA"
, "coll://collTree/collB"
, "coll://collTree/collB/subColl"
];
for(var i = 0; i < targetFiles.length; i++){
var targetFile = targetFiles[i];
DOpus.Output("Checking for: " + targetFile);
for(var j = 0; j < parentArray.length; j++){
var parentItem = parentArray[j];
var check = DOpus.FSUtil.Exists(parentItem+"/"+targetFile);
if(check)
DOpus.Output(targetFile + " exists in : " + parentItem );
};
}
}
//Get array of filenames from selected files, mostly lifted from "Commands to copy selected filenames to the clipboard" in DOpus FAQ
function NamesFromClickData(clickData){
clickData.func.command.deselect = false;
var tab = clickData.func.sourcetab;
// Put names in array
var nameArr = new Array();
if (tab.selected.count == 0){
// Nothing selected? Use the current folder path instead.
nameArr.push(tab.path.filepart);
// Use these 3 lines instead of above line to automatically select all files instead when nothing is selected.
// var items = tab.all;
// for (var eItems = new Enumerator(items); !eItems.atEnd(); eItems.moveNext())
// nameArr.push(eItems.item().name);
}
else{
// Something selected? Get just the selection.
var items = tab.selected;
for (var eItems = new Enumerator(items); !eItems.atEnd(); eItems.moveNext())
nameArr.push(eItems.item().name);
}
return nameArr;
}
- Selected the target files or folders, and clicked the new button. The result is outputted to the Script Log. (Accessible via Help >> Logs >> Script Log)
[Output]
Checking for: FileABC.png
FileABC.png exists in : coll://collTree/collB/subColl
Checking for: FolderABC
FolderABC exists in : coll://collTree/collA