Search : in
By :

Script to Search and Remove All Hidden Folder

Last answer on Feb 9, 2009 10:45:00 am GMT neonjacob, on Dec 12, 2008 9:57:00 am GMT 
 Report this message to moderators

Hello,

Can someone help me with a Script (VB or BAT : Prefferebly BAT Script) That will search and delete all Files and Folders (Even the folders that contain subfolders and files) which has Hidden Attribute
in a particular drive or folder. That is the script, when run, will search for all files and folders in a drive and will delete all the files and folders which are hidden but will not affect of delete files which are not hidden.

I actually want this for getting rid of some nasty redundant virus which comes via USB drives and memory cards. Usually they don't show up in the explorer and I have to manually delete them from command line by changing their attributes:

command:

attrib filename.ext -h -r -s

then del

del filename.ext


What i want actually is getting some script to make the process simpler for ignorant people here in my office who unknowingly infect the computers by running the virus codes. The antivirus does not helps much. I am planning to make an exe out of that batch script and add that in the Right Click Context Menu of Drives and Folders. I don't care if other important files with Hidden Attribute gets deleted in this procedure because Usually the Source are Memory cards and the files that are needed are only Image Files which are not hidden and therefore would not be affected by this procedure. Also if some filter can be created for certain extensions like jpeg,raw etc for not to be deleted, it would be better.

Please help me out.


Thank You

Configuration: Windows XP,2000,2003
Firefox 2.0.0.18

Best answers for « Script to Search and Remove All Hidden Folder » in :
How to remove "NewFolder.exe" virus? ShowHow to remove "NewFolder.exe" virus? Issue Solution Issue Newfolder.exe is a virus (Malicious folder) which real name is Iddono, appear everywhere in your hard-drive. Once it is executed, some malicious process will be started like...
Remove Directory Links from Favorites ShowRemove Directory Links from favourites Hiding Links folder Permanently delete the Links folder Despite deleting the folder "Links" in favorites, this one is regenerated automatically when you restart the computer. There are two...
[Windows 7] The hidden partition Show[Windows 7] The hidden partition Intro Purpose of this partition Intro Upon first installation, Windows 7 will automatically create a hidden primary partition. It's size varies to 100 or 200 MB depending on the total capacity...
Download Hide My Folders ShowDescription The application is designed by Eltima Software GmbH. The application is based on protecting your private documents. It has been awarded from various places and it offers an intuitive interface for its users. The application guarantees...
Download WinMend Folder Hidden ShowDescription The application is designed by WinMend.com. WinMend Folder Hidden is a tool that allows you to hide folders quickly. Simple and easy to use, the application has been awarded from various places. Offering an intuitive interface, the...
UNIX Commands ShowTable of the main UNIX commands Unix Commands Description Options ls lists the content of a directory -a Displays all files, including hidden files -I Displays a...
Sharing and permissions in Windows NT ShowIntroduction to folder sharing Sharing allows resources to be designated as being available to all users over a network. When a folder is shared, users can log into the folder from across the network and access the files within, as though the...

1

Aadhi, on Dec 12, 2008 10:33:27 am GMT
  • +2

Hi,

To Delete whole tree you can use this:

FOR /F "tokens=*" %%G IN ('DIR /B /AD /S *.gif*') DO RMDIR /S /Q %%G


DIR /B /AD /S *.gif*
lists all files that are named ".gif"
/B makes the output "bare" with nothing but the file name
/AD only lists directories
/S recurses subdirectories to include their contents if they match the listing criteria


RMDIR /S /Q [path/name]
deletes the directory [path/dir] and all of it's children

FOR /F processes each item (in this case directories) in the set IN ('[command]') by executing the DO [command]

%%G is a parameter, which in this example is a directory name
"tokens=*" says that all the characters output in a line (i.e. by the dir command) are assigned to the parameter %%G

For the Hidden files selection you can refer the Microsoft Command Line Reference (below link) for more on FOR:

http://technet.microsoft.com/en-au/library/bb491071.aspx

Regards!
Aadhi

Reply to Aadhi

2

Aadhi, on Dec 12, 2008 10:39:50 am GMT

Hi,

In addition these are my tips for Hidden files operation, compile yourself and try:

XCOPY /H copies the files, including the hidden files to a new destination

DEL /A-H deletes non-hidden files from the new folder

DEL /AH deletes hidden files from the original folder

Regards!
Aadhi

Reply to Aadhi

3

neonjacob, on Dec 12, 2008 12:15:58 pm GMT
  • +1

Thanks 4 the reply but it seems you didn't understood what I want. I want to search and remove only the hidden files and folders.

Reply to neonjacob

4

Kikiss, on Jan 12, 2009 11:44:06 am GMT

Copy whole thing to another location using: xcopy <oldplace> <newplace> /E
This way you will get hidden files and folders free copy.

Reply to Kikiss

5

neoman2445, on Jan 17, 2009 7:32:35 pm GMT

How can I FIND and delete hidden files. The files with virus shows up in Thunderbird inbox files that are hidden. But while I pull that up using the %AppData% in the cmd line. It shows the TB files, but the virus do not show up.

How can I locate these files, they do not show up on search, but show up in virus report, and how do I delete them. I really appreciate the help.

Reply to neoman2445

6

 how to remove removable disk.exe, on Feb 9, 2009 10:45:00 am GMT
  • +2

Hi every one there,
those hidden files you need to remove them as follows.


change path to the following directories
1: system32 and local drives
type: attrib -h -s -a -r filename
del filename

Reply to how to remove removable disk.exe