Set fso=Server.CreateObject("Scripting.FileSystemObject")
<%Set fso=Server.CreateObject("Scripting.FileSystemObject")%><%=fso.GetDriveName("d:")%><br><%=fso.GetDrive("d:")%>
<%Set fso=Server.CreateObject("Scripting.FileSystemObject")Set drv=fso.GetDrive(fso.GetDriveName("d:"))%>該盤的空間大?。?lt;%=drv.TotalSize%><br>該盤的剩余空間大?。?lt;%=drv.FreeSpace%>
<%Function ShowDriveInfo(drvPath) Dim fso, drv, s Set fso = CreateObject("Scripting.FileSystemObject") Set drv = fso.GetDrive(fso.GetDriveName(drvPath)) s = "驅(qū)動(dòng)盤" & drv & "的卷標(biāo)是:" s = s & drv.VolumeName & "<br>" s = s & "總計(jì)空間:" & drv.TotalSize & "<br>" s = s & "剩余空間:" & drv.FreeSpace & "<br>" s = s & "文件類型:" & drv.DriveType & "<br>" s = s & "文件系統(tǒng):" & drv.FileSystem Response.Write sEnd Function%><%on error resume nextwhatpath=request.form("path")if whatpath<>"" thenShowDriveInfo(whatpath)end if%><form action="drvinfo.asp" method="post"><input name="path"><input type="submit"></form>
<%Function tran(Driver)Select Case DriverCase 0: tran="設(shè)備無(wú)法識(shí)別"Case 1: tran="軟盤驅(qū)動(dòng)器"Case 2: tran="硬盤驅(qū)動(dòng)器"Case 3: tran="網(wǎng)絡(luò)硬盤驅(qū)動(dòng)器"Case 4: tran="光盤驅(qū)動(dòng)器"Case 5: tran="RAM虛擬磁盤"End SelectEnd Functionset fso=Server.CreateObject("Scripting.FileSystemObject")%><table border=1 width="100%"><tr><td>盤符</td><td>類型</td><td>卷標(biāo)</td><td>總計(jì)大小</td><td>可用空間</td><td>文件系統(tǒng)</td><td>序列號(hào)</td><td>是否可用</td><td>路徑</td></tr><%on error resume nextFor each drv in fso.Drives Response.Write "<tr>" Response.Write "<td>" & drv.DriveLetter & "</td>" Response.write "<td>" & tran(drv.DriveType) & "</td>" Response.write "<td>" & drv.VolumeName & "</td>" Response.write "<td>" & FormatNumber(drv.TotalSize / 1024, 0)& "</td>" Response.write "<td>" & FormatNumber(drv.Availablespace / 1024, 0) & "</td>" Response.write "<td>" & drv.FileSystem & "</td>" Response.write "<td>" & drv.SerialNumber & "</td>" Response.write "<td>" & drv.IsReady & "</td>" Response.write "<td>" & drv.Path & "</td>" Response.Write "</tr>"Nextset fs=nothing%></table>
www.cnbruce.com/code/showall.asp
恩,是不是很神氣?那你可以對(duì)自己的機(jī)器調(diào)試,然后上傳到自己的空間去調(diào)試,你會(huì)發(fā)現(xiàn)服務(wù)商會(huì)你進(jìn)行了些設(shè)置:)
當(dāng)然更神的還在后面面,比如對(duì)文件夾,對(duì)文件的操作(包括添加、修改和刪除)。ps:你對(duì)驅(qū)動(dòng)器是不能輕易添加刪除的:)
| ||
| ||
聯(lián)系客服