Jump to content

CLI - how to list all folders in repo (not workspace)


Graeme
 Share

Recommended Posts

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.

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.

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.

Posted much the same question to SO yesterday, without any replies as yet.

Link to comment
Share on other sites

Looks 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.

 

Link to comment
Share on other sites

Just to close the loop here - 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 allowed you to retrieve only folder data and the filtering all done server side.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...