ASP function FileSystemObject More

xiaoxiao2021-03-06  64

SET FS = Server.createObject ("scripting.filesystemobject")

1. Whether the file exists

IF (fs.fileexists ("c: /winnt/cursors/3dgarro.cur")) = True Then Response.write ("File C: /Winnt/Cursors/3Dgarro.cur exists") Else Response.write ("File C: /winnt/cursors/3dgarro.cur does not exist. ") End IF2. The directory exists if fs.folderexists ("c: / temp") = true the reboardse.write ("Folder C: / Temp does not exist.") End. IF3. Whether the disk exists if fs.driveexists ("C:") = True Then Response.write ("Drive C: DOES NOTST.") End ifresponse.write ("<") END IFRESPONSE.WRITE ("< Br> ") IF fs.driveexists (" G: ") = True Ten Response.write (" Drive G: Exists ") Else Response.write (" Drive G: Does NOT EXIST. ") End IF4. The disk directory where the file is located P = fs.getdrivename ("c: /winnt/cursors/3dgarro.cur") Response.write ("The Drive Name is:" & p) Results: C: 5. The file directory where the file is located P = fs.getParentFoldername ("c: /winnt/cursors/3dgarro.cur") Response.write ("The Parent Folder Name of C: /Winnt/cursors/3Dgarro.cur IS:" & P ) Result: C: / WinNT / Cursors6. Get the file extension response.write (fs.getextensionname ("c: /winnt/cursors/3dgarro.cur") Result: CUR7. Get a full name. Response.write (fs.getfilename) Results: 3dgarro.cur8. Get the first name Response.write (fs.getbasename ("c: /winnt/cursors/3dgarro.)) response.write ("
") Response.write (fs.getbasename (" C: / Winnt / Cursors / ") Response.write ("
") Response.write (" C: / Winnt / ") Result: 3Dgarro Cursors Winnt Set Fs = Nothing loaded:

转载请注明原文地址:https://www.9cbs.com/read-106116.html

New Post(0)