Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
–1 vote
366 views
in .NET FTP by (110 points)
Hi -

Is it possible to transfer file attributes such as read-only flag via ftp or such to a local directory.

I'm finding that when I transfer a read-only file it loses its setting when it arrives.

Thanks!

1 Answer

0 votes
by (51.6k points)

If you're using SFTP then you can use the SecureFTPConnection.ChangeMode method to set the permissions of files on the server. For example, the following will set read-only permissions for the owner of a file:

ftpConnection.ChangeMode("0400", "/remote/file/path");
by (110 points)
Thank you for responding - that's not quite what I'm trying to do however.

Say the file on the server has its read-only flag set there, is it possible to maintain that value once it is transferred to a local machine?

Thanks
by (51.6k points)
If you are referring to a file on the server being read only, I assume you mean the current logged in user has only read permission and not write permission (and not the Windows-specific 'read-only' flag).

If you want to replicate this on the local file after downloading, you'll need to use System.Security.AccessControl after transferring the file to set its access rules.

Categories

...