by a Thinker, Sailor, Blogger, Irreverent Guy from Madras

Cannot unhide hidden folders and files in USB drive


Three days back a friend came to me with a funny problem.  It seems he has quite a lot of files (and folders) in his 16GB USB drive and suddenly all that data has disappeared.

Worried, he scanned the seemingly empty pen drive with Comodo Internet Security and could see that Comodo is scanning all the files.  Comodo reported that so many hundreds of files scanned with no virus found.

If he had called up over the phone, I could have told him that the files (and folders) have been hidden by some malware or more likely by his daughter unknowingly or in jest.

However, he had brought the USB drive and so we plugged it into my PC.  Sure enough all the files and folders showed up, but as hidden.  In his own laptop, the ‘Folder Options’ (must) have been set ‘not to show hidden files’ and ‘hide system files’.

If you don’t how how to enable/disable them, read the Microsoft help page here [http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/win_fcab_show_file_extensions.mspx?mfr=true].  Though the page explains procedure in Windows XP, it is the same for all Windows.

At that point the fun started.  Usually right clicking the hidden folder (or file) and unchecking the ‘hidden’ box in the ‘properties’ dialogue popup solves the problem.  But in this case the hidden checkbox itself was greyed out.  The ‘read only’ box was also enabled and unchecking or disabling the read only box had no effect.

greyed_out_hidden_checkbox

After scratching head for a couple of minutes, I recalled the (almost forgotten) DOS tricks and the ‘attrib’ command.  So I opened the command prompt (as administrator) and proceeded to remove the ‘hidden’ attribute.  To face failure.  The ‘attrib’ command with ‘-h’ switch could not do the job.

Puzzled, I ran the ‘attrib’ command without any parameters to display the attributes already assigned to the files.

attrib_dump

There - the dump shows that the files (and folders) have been assigned ‘system’ file attribute, which cannot be changed from the properties dialogue box.  They also have ‘hidden’ and ‘read only’ attributes set.   Now that the trouble has been identified, it was a simple fix. 

Run the command (without quotes): “attrib -a -s -h -r /s /d /l”

attrib_set

Problem solved.
:-D

Tip:  If you ever run into the problem check to make sure you are in the ‘correct’ USB drive before you run this command - if you’re in the C:, for e.g., the system files may be skrewed up permanently.

Tip 2: If you have had installed some programs in the pen drive, be careful with this command.  Removing ‘system’ file attribute from program files might make them inoperable.

Tip 3: To change to the correct USB drive, see the command prompt image above.  In this case, the pen drive was in ‘H:’ drive.  So I had to type “cd h:” once, and again “h:” to switch to the drive.

Tip 4: The switch '/l' was introduced in Windows Vista.  Hence, using it on Windows XP would throw an invalid switch error.  see comment @Unamed below. (update 17 Feb 2013).

Note:  The image captures are a reconstruction.  The pen drive pictured is my own, with some random files thrown in - not from my friends’.
;-)



No comments:

Post a Comment

Support - Donate

Your Blog is

Donate thro ECWID

Contact Form