Reputation: 555
I'm writing a script to find all folders on a machine, which not connected to any workspace,
How can I get the workspace name (or null) of a specific folder on a specific host?
(I already examined the answers here, but that doesn't answer my question)
Upvotes: 0
Views: 153
Reputation: 16349
The best way to do this is to use 'p4 where'. Running 'p4 -c where ' should tell you how Perforce is interpreting the foldername in question for that particular workspace.
If you want to do the detailed analysis yourself:
The root directory of the workspace on the host is stored in the Root: field of the workspace spec and can be displayed with 'client -o'.
Note that there can be AltRoots, that is, multiple valid root directories for a single workspace.
So as you iterate through the workspaces for a specific host, look at their Root and AltRoot directories, and see if any of those directories are the parent of the folder you're interested in.
Upvotes: 1