It's all about the answers!

Ask a question

How to use scm.exe to query multiple file custom attributes efficiently?

Thomas Moran (11) | asked Aug 19 '19, 11:35 a.m.

Hi All,

What is the most efficient way of querying custom attributes using scm.exe for multiple files in a directory?

Im currently listing out the files and iterating through each one running a get custom-attribute command, this takes 30-40 seconds per item and having hundreds of items adds a massive amount of execution time to scripts.

Any ideas on better ways to do this?

One answer

permanent link
David Lafreniere (4.8k7) | answered Aug 19 '19, 2:37 p.m.
-Try using 'lscm' instead of 'scm'. This should keep the SCM daemon running and should speed it up a bit (by avoiding having to start one up every time)
-The 'get custom-attribute' command takes a space separated list of files, so you might want to collect a few files up and then run the command (of course you will have to manage the batching of the files, and parsing of the results).
-Writing your own code using the plain-Java APIs. See: IWorkspaceManager.getCustomAttributes(IVersionableHandle[] state, IProgressMonitor monitor)

Your answer

Register or to post your answer.