EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SftpClient.MakeDirectory

#3546
Posted: 08/15/2007 11:13:08
by Frank Davis (Standard support level)
Joined: 08/15/2007
Posts: 6

I have the ability to create a directory on our SFTP site. I cannot figure out what values I am suppose to pass to give the directory read and write permissions. I reviewed the documentation but its not clear what values I am suppose to pass. Can you show me a piece of code that sets these properties? FYI - I am using VB.net 2005

Sub MakeDirectory(ByVal Path As String, ByVal Attributes As TElSftpFileAttributes)
#3549
Posted: 08/15/2007 11:55:51
by Eugene Mayevski (Team)

Quote
Frank Davis wrote:
I cannot figure out what values I am suppose to pass to give the directory read and write permissions


Assuming that you want to set 666 unix permissions, the code would be

Code
Dim Attributes As TElSftpFileAttributes = new TElSftpFileAttributes()
Atributes.UserRead = true
Atributes.UserWrite = true
Atributes.UserExecute = false
Atributes.GroupRead = true
Atributes.GroupWrite = true
Atributes.GroupExecute = false
Atributes.OtherRead = true
Atributes.OtherWrite = true
Atributes.OtherExecute = false
Attributes.ATime = DateTime.Now
Attributes.IncludedAttributes = SBSftpCommon.saPermissions OR SBSftpCommon.saATime

Client.MakeDirectory(Path, Attributes)


The code is written in the browser so there might be some minor issues/typos but you should get the idea.


Sincerely yours
Eugene Mayevski
#3551
Posted: 08/15/2007 13:10:13
by Eugene Mayevski (Team)

Note, that in the above sample I create the directory, for which Execute permission is set to false. This will lead to the behavior when directory contents can't be read. The proper way would be to set UserExecute, GroupExecute and OtherExecute to true, but for the example I decided to set them to false. In real life set them to true (unless you need to prevent the directory from being read).


Sincerely yours
Eugene Mayevski
#3552
Posted: 08/15/2007 14:25:06
by Frank Davis (Standard support level)
Joined: 08/15/2007
Posts: 6

Ok.
Just one question.

SBSftpCommon.saPermission­s OR SBSftpCommon.saATime

'saPermission­s' is not a member of 'SBSftpCommon'

Am I missing something?
#3554
Posted: 08/15/2007 14:40:20
by Eugene Mayevski (Team)

Attributes.IncludedAttributes = SBSftpCommon.Unit.saPermissions Or SBSftpCommon.Unit.saATime

Also, saATime is included as an example of how to set multiple different attributes. You don't necessarily need to set it.


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 2562 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!