Find the Drive with the Most Available Disk Space

Here’s a script that will help you find the disk drive with the most available space.

create proc os_bigdrive @driveletter char(1) out ,@debug tinyint=0
as

create table #diskspace(drive char(1) null , space int null)

if
@debug > 0 exec master..xp_fixeddrives
insert into #diskspace exec
master..xp_fixeddrives

set rowcount 1
select @driveletter = drive
from #diskspace order by space desc
set rowcount 0
go

Latest Articles