I was wondering if there is an easy way to get a listing (text file, printout, report, etc.) of what files and folders reside undera particular directory/project in Vault? Can you do this from the client or looking directly at the DB?
Thanks,
Keith
Print directory contents?
Moderator: SourceGear
One option is mentioned here: http://support.sourcegear.com/viewtopic ... ght=report
Or you can try the following:
Or you can try the following:
Code: Select all
DECLARE @repid [int], @lasttxid [bigint];
SELECT @repid = <YOUR_REPOSITORY_ID_HERE> -- USE SELECT repid, name FROM sgvault.dbo.tblrepositories -- to determine the correct repository id.
SELECT @lasttxid = currenttxid
FROM tblrepositories
WHERE repid = @repid
DECLARE @@t TABLE
(
treelevel int not null,
pph int not null,
objverid bigint not null,
objid bigint not null,
objversion bigint not null,
name nvarchar(256) not null,
objprops smallint not null,
pinnedfromobjverid bigint not null,
fph int not null,
fullpath nvarchar(1024) null,
primary key (treelevel, pph, fph, objid)
)
INSERT INTO @@t
(treelevel, pph, objverid, objid, objversion, name, objprops, pinnedfromobjverid, fph)
SELECT treelevel, parentpathhash, objverid, objid, objversion, LOWER(name), objprops, pinnedfromobjverid, fullpathhash
FROM sgvault.dbo.ufngettreestructure(@repid, @lasttxid, default)
DECLARE @@treelevel int, @@rowsaffected int
SET @@treelevel = 0
UPDATE @@t
SET fullpath = name
WHERE treelevel = @@treelevel
SET @@rowsaffected = @@ROWCOUNT
WHILE ( @@rowsaffected > 0 )
BEGIN
UPDATE t
SET t.fullpath = prev.fullpath + N'/' + t.name
FROM @@t t
INNER JOIN @@t prev ON (prev.treelevel = @@treelevel) AND (prev.fph = t.pph)
WHERE (t.treelevel = (@@treelevel + 1))
SELECT @@rowsaffected = @@ROWCOUNT, @@treelevel = @@treelevel + 1
END -- WHILE
SELECT fullpath FROM @@t ORDER BY treelevel, pph, name;