RayT
asked on
Resetting the archive bit on a specific file
How do reset the archive bit on a specific file using Visual Basic?
How is this done using
File.SetAttributes()
How is this done using
File.SetAttributes()
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks! It worked. Here's the sub I ended up creating. I'm a reusable code junkie :)
Shared Sub RemoveAttribute(inFilePath As String, attributesToRemove As FileAttributes)
Dim attributes As FileAttributes = File.GetAttributes(inFileP ath)
attributes = (attributes And Not attributesToRemove)
File.SetAttributes(inFileP ath, attributes)
End Sub
Shared Sub RemoveAttribute(inFilePath
Dim attributes As FileAttributes = File.GetAttributes(inFileP
attributes = (attributes And Not attributesToRemove)
File.SetAttributes(inFileP
End Sub
Thanks for sharing your code Ray!
https://docs.microsoft.com/en-us/dotnet/api/system.io.file.setattributes?view=netframework-4.7.2