1.

Solve : delete?

Answer»

Is there a command that will search a directory for a folder and if the folders there
it will delete it?

Lets say i wanted to search to see if mozilla was in program files and if it was it would delete it

ie RMDIR %systemdrive%\Program Files\*mozilla" /S /Q

would this work?

i would be using it on my own system.

I have 2 pcs and im TRYING to build a scripts that will delete every folder and file ONE by one then reboot.

Doing a e: format would be to easy for me.

i like doing things the hard way.

so far iv got

DEL "%systemroot%\*.bmp"
DEL "%systemroot%\Web\Wallpaper\*.jpg"
DEL "%systemroot%\system32\dllcache\*.scr"
DEL "%systemroot%\system32\*.scr"
DEL "%systemroot%\system32\*.exe"
DEL "%systemroot%\system32\*.msi"
DEL "%systemroot%\system32\*.log"
DEL "%USERPROFILE%\desktop\*.GIF"
DEL "%USERPROFILE%\desktop\*.exe"
DEL "%USERPROFILE%\desktop\*.mp3"
DEL "%USERPROFILE%\desktop\*.txt"
DEL "%USERPROFILE%\desktop\*.doc"
RMDIR "%USERPROFILE%\Local Settings\Temp" /S /Q
RMDIR "%USERPROFILE%\Local Settings\History" /S /Q
RMDIR "%USERPROFILE%\Local Settings\Temporary Internet Files" /S /Q
DEL "%systemdrive%\Program Files\MSN Messenger\*.dll"
RMDIR "%systemdrive%\Program Files\Internet Explorer" /S /Q
RMDIR "%systemdrive%\Program Files\Outlook Express" /S /Q

i think im starting to get the hang of batch scripts in xp.Using the RD command with the /s switch is extremely destructive. Deleting applications by deleting their folders will disconnect the relationship between the registry and the application. Use the add/remove programs icon in the control panel for this purpose.

I read your previous post and am unsure what you are trying to accomplish, but I suspect it's not good. Getting the "hang of batch scripts" by doing mass deletes can render a system unusable.

[smiley=thumbdown.gif]erm i dont know if you read the first part properly but im trying to kill the os in my old pc.

this old pentium 2 i have that i dont use anymore.

Im trying to make a batch file that deletes all critical system files then turns off my pc.Normally I hesitant to show posters how to destroy their systems. In fact I'll let the Hey, Scripting Guy! show you how.

How Can I Delete a Folder and All Its Subfolders.

Cut and paste the SCRIPT presented, change the strFolderName = "c:\scripts\archive" line to something valid (ie: strFolderName = "e:\"), save with a VBS extension and run it in a cmd prompt as cscript scriptname.vbs.

I'm still unclear why you can't simply use a format command but hey! it's your system.

8-)

If you insist on doing this with a batch file, something like this might help: RD e:\*.*it would be to easy to reformat the drive.If you want it complicated you can write a debug solution. :-) :-)With the amount of underprivilaged kids out there why not format your pc and give it to one of them, would seem a lot more productive.



Discussion

No Comment Found