Hi. I am trying to get a bunch of UNC path data sizes. I have the following so far:
This works fine, however one row has the path and my next row has the total size. For example:
\\server\archive\Richland\RICH000001
7.899834
Is there a way I can get the path and total size on the same row? For example:
\\server\archive\Richland\RICH000001, 7.899834
Something like:
Thanks for your time!
Code:
create table #temp (path varchar(100), TotalSize varchar(100))
declare @cmd varchar(1000)='powershell "(Get-ChildItem ''\\server\Archive\Richland\RICH000001'' -recurse | Measure-Object -property length -sum).sum/1MB"'
declare @path varchar(100)='\\server\Archive\Richland\RICH000001'
insert into #temp
select @path
insert into #temp
exec xp_cmdshell @cmd
This works fine, however one row has the path and my next row has the total size. For example:
\\server\archive\Richland\RICH000001
7.899834
Is there a way I can get the path and total size on the same row? For example:
\\server\archive\Richland\RICH000001, 7.899834
Something like:
Code:
insert into #temp select @path, exec xp_cmdshell @CMD
Thanks for your time!