[RESOLVED] File Attributes on secondary drive
I know you can use windows to protect the files on your hard drives, understand that pretty well.....however, does it also carry over it you take a hard drive out and connect it to another machine without the same security setup? What I mean is will the security measures persist if the hard drive itself is switched out? How could you make this happen other than running encryption on each and every file.....and if the other computer is using encryption can you still open the files??
Thanks,
David
Re: File Attributes on secondary drive
Here's an option. This sample from AllAPI.net can encrypt a file or even a complete directory. If directory is encrypted, then only new files created in the same directory are also encrypted. So; create a new directory, encrypt it and copy everything you need to have encrypted into it. However, works only on NTFS and can be executed only on W2K or later:
VB Code:
Private Declare Function EncryptFile Lib "ADVAPI32" Alias "EncryptFileA" _
(ByVal lpFileName As String) As Boolean
Private Declare Function DecryptFile Lib "ADVAPI32" Alias "DecryptFileA" _
(ByVal lpFileName As String, ByVal dwReserved As Long) As Boolean
'to encrypt
Private Sub Form_Load()
Encrypt "c:\myDir"
End Sub
Sub Encrypt(sFile As String)
If EncryptFile(sFile) Then
MsgBox "Successfully encrypted!"
End If
End Sub
'to decrypt
Private Sub Command1_Click()
Decrypt "c:\myDir"
End Sub
Sub Decrypt(sFile As String)
If DecryptFile(sFile, 0) = True Then
MsgBox "Successfully decrypted!"
End If
End Sub
These files/directories are after encrypton accessible only to you. To test it, switch to another user and you'll get the idea. I think that when you'll encrypt your files/directories you wont be able to access theme on another computer.