Link to home
Create AccountLog in
Avatar of RayT
RayTFlag for United States of America

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()
ASKER CERTIFIED SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of RayT

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(inFilePath)

        attributes = (attributes And Not attributesToRemove)

        File.SetAttributes(inFilePath, attributes)
    End Sub
Thanks for sharing your code Ray!