List selected directory paths in the repository.

Namespace: Perforce.P4
Assembly: p4api.net (in p4api.net.dll) Version: 2017.3.160.836 (2017.3.160.0836)

Syntax

C#
public IList<string> GetDepotDirs(
	IList<string> dirs,
	Options options
)
Visual Basic
Public Function GetDepotDirs ( _
	dirs As IList(Of String), _
	options As Options _
) As IList(Of String)
Visual C++
public:
IList<String^>^ GetDepotDirs(
	IList<String^>^ dirs, 
	Options^ options
)

Parameters

dirs
Type: System.Collections.Generic..::..IList<(Of <(<'String>)>)>
options
Type: Perforce.P4..::..Options

Return Value

Remarks


p4 help dirs

dirs -- List depot subdirectories

p4 dirs [-C -D -H] [-S stream] dir[revRange] ...

List directories that match the specified file pattern (dir).
This command does not support the recursive wildcard (...).
Use the * wildcard instead.

Perforce does not track directories individually. A path is treated
as a directory if there are any undeleted files with that path as a
prefix.

By default, all directories containing files are listed. If the dir
argument includes a revision range, only directories containing files
in the range are listed. For details about specifying file revisions,
see 'p4 help revisions'.

The -C flag lists only directories that fall within the current
client view.

The -D flag includes directories containing only deleted files.

The -H flag lists directories containing files synced to the current
client workspace.

The -S flag limits output to depot directories mapped in a stream's
client view.

Examples

To get dirs on the server that fall within the current client view:
CopyC#
GetDepotDirsCmdOptions opts =
new GetDepotDirsCmdOptions(GetDepotDirsCmdFlags.CurrentClientOnly, null);

IList<String> dirs = new List<String>()
dirs.Add("//*");

IList<String> target = Repository.GetDepotDirs(dirs, opts);
To get dirs on the server that contain files synced to the current client workspace:
CopyC#
GetDepotDirsCmdOptions opts =
new GetDepotDirsCmdOptions(GetDepotDirsCmdFlags.SyncedDirs, null);

IList<String> dirs = new List<String>()
dirs.Add("//*");

IList<String> target = Repository.GetDepotDirs(dirs, opts);
To get dirs on the server that fall under the path //depot/main/:
CopyC#
GetDepotDirsCmdOptions opts =
new GetDepotDirsCmdOptions(GetDepotDirsCmdFlags.None, null);

IList<String> dirs = new List<String>()
dirs.Add("//depot/main/*");

IList<String> target = Repository.GetDepotDirs(dirs, opts);

See Also