Click here to Skip to main content
Click here to Skip to main content

Tagged as

Unhide folders

, 24 Apr 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
unhide folders after virus attack

Introduction

Most of us attached by the virus which adds the hidden attribute to every folder on your system. However after cleaning your system, your folders are still hidden.

So, that tip eases the unhide process of yours folders


Using the code

The key of this tip is this line

 File.SetAttributes("Dir", IO.FileAttributes.Normal)

The main part

Dim i As Long

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'To start scanning for new logical drives
        ' Scanning every 500ms
        Timer1.Interval = 500
        Timer1.Start()

        'Adding the logical drives in the combobox
        Dim dirs() As String = Directory.GetLogicalDrives()

        For Me.i = dirs.GetLowerBound(0) To dirs.GetUpperBound(0)
            ComboBox1.Items.Add(dirs(i))
        Next i

    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        Try
            For Each Dir As String In Directory.GetDirectories(ComboBox1.Text)
                ' Not included as cant be accessed 
                If Dir = ComboBox1.Text & "System Volume Information" Then
                Else
                    File.SetAttributes(Dir, IO.FileAttributes.Normal)
                End If
            Next

        Catch 'to catch any ex

        End Try

    End Sub

But, you need to check periodically any change in your logical drives added/removed

    Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
        'Clearing the combobox only if new logical drive inserted or removed
        If ComboBox1.Items.Item(ComboBox1.Items.Count - 1).ToString <> System.IO.Directory.GetLogicalDrives.Last.ToString Then

            ComboBox1.Items.Clear()

            Dim dirs() As String = Directory.GetLogicalDrives()

            For Me.i = dirs.GetLowerBound(0) To dirs.GetUpperBound(0)
                ComboBox1.Items.Add(dirs(i))
            Next i

        Else

        End If

    End Sub


License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

mohamedkamaleed
Systems Engineer Contech Schneider System Integrator
Egypt Egypt
No Biography provided
Follow on   Twitter   LinkedIn

Comments and Discussions

 
GeneralAlternate PinprotectorDaveAuld30-Apr-14 5:22 
QuestionAttrib PinprotectorDaveAuld24-Apr-14 22:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.141022.1 | Last Updated 25 Apr 2014
Article Copyright 2014 by mohamedkamaleed
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid