Find the Drive with the Most Available Disk Space | Database Journal

Find the Drive with the Most Available Disk Space

Written By
Alan Enderby
Alan Enderby
Oct 8, 2000
1 minute read

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

Database Journal Logo

DatabaseJournal.com publishes relevant, up-to-date and pragmatic articles on the use of database hardware and management tools and serves as a forum for professional knowledge about proprietary, open source and cloud-based databases--foundational technology for all IT systems. We publish insightful articles about new products, best practices and trends; readers help each other out on various database questions and problems. Database management systems (DBMS) and database security processes are also key areas of focus at DatabaseJournal.com.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.