command-line-interfaceplasticscm

PlasticSCM CLI - how to list all folders in repo?


I'm using the below command to list the contents of a repo, but would like to limit the results to only include folders (i.e. no files).

cm ls --tree=br:branch@repo@server:port -R --format={path}

Using cm help ls does not seem to indicate how or whether this is possible.

Edit: I realise I could filter client side, but I do not want to do this as some of our repos are large (contain many files) and this is too slow.

Edit: Using the path filtering ls provides seems like it would work... but, I can't find a way to get it to only include folders. For example, cm ls *.cs would include all .cs files.

Edit: Looking like my only option will be to recursively walk a repo's "file system", pulling it one folder at a time and recursing into each subfolder - this will hopefully be much faster than pulling everything using the recursive ls option and then filtering it all client side.


Solution

  • Luckily my use-case was for populating a user interface. So, I could get away with not using the -r (recursive) option and instead simply query the path content of each folder as the user navigated. As Carlos suggested, this involves querying the path content and then discarding the non-folder data (all done client side). While more tedious to implement, it works and is performant enough.

    It would be good if ls (or some other mechanism) allowed you to retrieve only folder data and the filtering all done server side.