Jump to content

How do I determine whether a folder had write Permission?


Bahman

Recommended Posts

-------------------------------------------------------------------------------I would like to determine whether or not a given folder in my server has write permission or not. I used fso object option and used Attributes object bur always I get number 16, regardless if it has write permission, read permission or nothing at all. What is the correct object that gives me that information. Currently, I have the following code to display information on the folder:Set fso = CreateObject("Scripting.FileSystemObject") Set a = fso.GetFolder(Server.MapPath("\") & folder_directory)Response.Write ("Attributes: " & a.Attributes & "<BR>")

Link to comment
Share on other sites

The attribute value of 16 indicates that the object is a folder. This is the list of attribute values:

0 = Normal file1 = Read-only file2 = Hidden file4 = System file16 = Folder or directory32 = File has changed since last backup1024 = Link or shortcut2048 = Compressed file

Link to comment
Share on other sites

How do capture error related to write permission?I try to delete a folder that does not have write permission, theregfore I get error and error messages. I would like to avoid receiving error message on screen and continue deleting other folders. I have been told I need to capture the error and do some checking there. How do capture error related to write permission?

Link to comment
Share on other sites

How do capture error related to write permission?I try to delete a folder that does not have write permission, theregfore I get error and error messages. I would like to avoid receiving error message on screen and continue deleting other folders. I have been told I need to capture the error and do some checking there. How do capture error related to write permission?
In javascript, java, and C#, you'd use a try/catch(/finally) block. It'd look something like this:
try{	// do some code here that may cause an error}catch(Exception e){	// handle the exception (error) here.}

Perhaps there's something like that in VB as well.EDIT: Found this link: http://msdn2.microsoft.com/en-us/library/f...6tz(VS.80).aspx

Link to comment
Share on other sites

or in classic asp vb script:

on error resume next		 	'some code 	if err.number <> 0 then		'handle error 	end if on error goto 0

error handling is pretty ugly in vb6 / vbscript

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...