FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Copying files





manlear
How would I make a .bat file to check every file in every directory on the computer for a certain file? (getting rid of viruses)
Also how could I make it check every file on my home network?
badai
how do you distinguish that certain file from any other file? name? size? date last modified?

and accessing infected file may trigger the virus and load it into memory, and make it infected other files.

just use any good antivirus to scan your whole system.
rickylau
I guess he are going to say he want to scan for a specified file name
manlear wrote:
For a certain file?

You've got luck, I found that it only take few lines to complete
Here is my own-made example, which prints full path of every .txt file in C:\ drive
Code:
CD \
FOR /D /r %%D IN ("*") DO (
cd %%D
FOR /R %%G IN ("*.txt") DO ECHO Found %%G
)

Now the step by step explanation.
A) Start the search process: we need to move to root directory first
Code:
CD \

B) Scan through every folders (matching name "*"), including the sub-folders (\r), and store the path to %D (in batch additional % is affixed)
Code:
FOR /D /r %%D IN ("*") DO <command>

C) We need to change the current directory to one the batch have found
Code:
cd %%D

D) Scan for a specified file (this time everything in txt format "*.txt") and store the path to %G, then perform another command for the file (this time we print "Found <file name>": ECHO Found %%G)
Code:
FOR /R %%G IN ("*.txt") DO ECHO Found %%G

Note: EVERY MATCH RULES [ IN (...) ] MUST HAVE AN ASTERISK "*" FOR WILDCARD (or "?" for single character wildcard), for example, if you would like to scan for a file exactly called "find_me.txt" you may specify the rule like "*find_me.txt" (Although "dont_find_me.txt" will also be found in this case... use your mind to avoid such problem Twisted Evil ).

Do some modification to the rules and the command and you can make a batch suitable for you. Good luck Wink
(Before this thread I think it is not possible and I prefer make a program or simply use Window explorer, although the command is not fast for full drive scan, it still works Smile )

manlear wrote:
How could I make it check every file on my home network?
Not possible if you want to check EVERY FILE on the whole network, since some directories (system folders, folders that have not been set to shared, and some folders inaccessible even locally) is not visible in other machines.

Hypothesis: we don't have any "special abilities" - such as hacking into the machines.


Conclusion: just like what badai mentioned, use softwares to do for you if possible, this reply just took me a lot of efforts...
manlear
Spank ya (: I don't like to use any type of anti-virus program because it just slows down your pc and causes potential viruses most of the time.
AftershockVibe
manlear wrote:
Spank ya (: I don't like to use any type of anti-virus program because it just slows down your pc and causes potential viruses most of the time.



Seriously, you're doing it wrong. The second point is not true, the first is relevant... but that's why AV's allow you to turn off "on access scanning". Then you can just do a scan when you decide you want to (like you are using a batch file to do here).
sonam
If you are usign your search engine did you have good sistem for removing virus from your computer. Some of them you cannot just delete. Maybe you will find it easy but for deleting you need hard work. Antivirus programs are better solution. If you want one very fast antivirus then maybe you can look for Prevx CSI http://www.prevx.com/freescan.asp Be carefull before you delete some files reported with this program (check on internet) because sometimes find some false/positive files. For example, ones it is find out one Outlook file like virus. I am using it for scanning and in some cases when my antivirus program is not react Prevx CSI is help me.

Sonam
Marcuzzo
AftershockVibe wrote:
manlear wrote:
Spank ya (: I don't like to use any type of anti-virus program because it just slows down your pc and causes potential viruses most of the time.



Seriously, you're doing it wrong. The second point is not true, the first is relevant... but that's why AV's allow you to turn off "on access scanning". Then you can just do a scan when you decide you want to (like you are using a batch file to do here).


exactly, I use Avira and I'm still running on a single core P4 with 1g of ram.... not slowing me down at all...

also,
I don't think you can remove files that are in use by a virus.
well..., maybe if it's creator is a scriptkiddy. but still, I have had to clean up a pc once which had a virus and I needed to unlock several files before deletion and still, the application I used could only
delete them at startup.
Related topics
Problem with hacking my computer
how to copying files between http using php ?
Windows XP Tricks & Tips!!!!
Networking XP and Xubuntu [SOLVED]
I bought a falsely advertised item on eBay... Sigh
partitioned D:\ drive questions
How to log on XP without administrator password ?
FTP connection problems - solved
Possible hard drive problem
CD copy error... pls help
Windows 7 RC1 on a HP tx2000 tablet
50+50 Frih$ . AHCI driver problem. Solve and get 100 Frih$.
Connection problems with PokerTracker 3 restore
Retrieving files from your iPod.
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.