Attribut Path ASP

Définition et utilisation

L'attribut Path est utilisé pour retourner le chemin pour le disque spécifié, le fichier ou le dossier.

Syntaxe :

DriveObject.Path 
FileObject.Path
FolderObject.Path

Exemple pour l'objet Drive

<%
dim fs,d
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("e:")
Response.Write("Le chemin est " & d.Path)
set d=nothing
set fs=nothing
%>

Sortie :

Le chemin est E:

Exemple pour l'objet File

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\asp\test.asp")
Response.Write("Le chemin est : " & f.Path)
set f=nothing
set fs=nothing
%>

Sortie :

Le chemin est : C:\asp\test.asp

Exemple pour l'objet Folder

<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\asp\test")
Response.Write("Le chemin est : " & fo.Path)
set fo=nothing
set fs=nothing
%>

Sortie :

Le chemin est : C:\asp\test