![]() We have used the command Server.MapPath to change the virtual path to physical path of the folder db. ![]() Here "db" is the name of the folder we are checking the existence. If objFSO.FolderExists(Server.MapPath("db")) Then Next we will use the If Then Else statement to check the condition of the file or folder. Set objFSO = Server.CreateObject("Scripting.FileSystemObject") We will use one variable to hold the instance of the FileSystemObject and using this we will check the existence of the file or folder. So before using any file or folder we can check the status of them.įileSystemObject or fso uses physical path of the file or folder to check the existence so before using this we have to convert the virtual path to physical path for our folders or files by using server.mappath object. This is often required to check the existence of a file or directory before using, otherwise system will generate an error message which is not good to display to the visitors. We can check whether file of folder exists at a location by using file system object ( FileSystemObject). We will be using this folder object Files property to get all the files present within the folder. After initiating the object we can instantiate the folder object. Here we will be using server MapPath to map the virtual path to real path as used by file system object. Getting the list of files inside a directory by using FileSystemObject in ASPīy using FileSystemObject (FSO)we can list out all the files of a directory.
0 Comments
Leave a Reply. |