What do you do when your Removal Device or USB gets affected by a virus and files are hidden? Most of the Antivirus scan the device and delete the virus only. So we can't see the files in our USB device which is hidden by the virus. So here, the "Ultimate USB Reset Attribute" comes with a powerful option.
Idea Behind the Code
I just embed my code with the existing one which is already available in here (CodeProject). So my first sincere thanks to CodeProject, without this I could not do it.
Using the Code
Using this code, the number of USB or removal devices is listed in a dropdown which is currently connected to a computer.
if(!Directory .Exists (currDir ))
pbar.Maximum += Directory.GetFileSystemEntries(currDir).Count();
foreach (string ff in Directory.GetFiles(currDir))
ResetAttribute((new FileInfo(ff)) as FileSystemInfo );
foreach (string dr in Directory.GetDirectories(currDir))
ResetAttribute((new DirectoryInfo(dr)) as FileSystemInfo);
fsi.Attributes &= ~FileAttributes.Hidden;
fsi.Attributes &= ~FileAttributes.System;
fsi.Attributes &= ~FileAttributes.ReadOnly;
pbar.Value += 1;
catch (Exception ex)
var drv = from dr in DriveInfo.GetDrives()
where dr.IsReady == true && dr.DriveType == DriveType.Removable
foreach (DriveInfo dinfo in drv)
cmbUSB.SelectedIndex = 0;
DriveInfo dr = new DriveInfo(cmbUSB.SelectedItem.ToString());
lblusb.Text = dr.VolumeLabel + " (" + dr.Name + ")";
Command Line Reseter
Just enter the Drive Letter that you want to reset. Using this code:
set /p letter=
attrib -s -h -a /s /d %letter%:\*.*
Points of Interest
Hope this version helps you. This is the general idea which I got in my dreams!!!
What is new in USB Reset Attribute?
- Command Line Reseter (you can reset your USB attributes using through Command Prompt too)
- For any file or folder "Access Denied" error is fixed by Take Ownership Registry Tweak.