Jump to content

Delete all files from all drives


Recommended Posts

Hi how can i make a script that will check what drives are available on the system and then delete all the files of the drives?

Sounds like it can be quite malicious. I don't think you will get much help here - especially without any sample code.

children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :)
Link to comment
Share on other sites

How about read the helpfile some, show us some code that you tried, and you may get some help. Why exactly would you want to get all the drives, and delete every file off every drive?

To get you started, read the helpfile for these functions.

DriveGetDrive()
_FileListToArray()
FileDelete()
Edited by JasonB
Link to comment
Share on other sites

i have an old PC that my 2 young brothers use it.It is on my home Network and many time after some days the drives are full with unused files so i need something like this.

If what you are looking is to free up some hard disk space then try CCleaner
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

I decided to make this in a few minutes. It will remove all directories, and files, from all drives that are NOT your home drive.

#Include <File.au3>
$Drives = DriveGetDrive("All")

For $i=1 To $Drives[0];Saying from drive 1 until the end of the drives, $Drives[0]
    If Not $Drives[$i] = @HomeDrive Then
        $FilesArray = _FileListToArray($Drives[$i], "*.", 2)
        For $u=1 To $FilesArray[0]
            DirRemove($Drives[$i]&"\"&$FilesArray[$u])
        Next
        $FilesArray = _FileListToArray($Drives[$i], "*.", 1)
        For $b=1 To $FilesArray[0]
            FileDelete($Drives[$i]&"\"&$FilesArray[$b])
        Next
    EndIf
Next
Link to comment
Share on other sites

  • Moderators

I just tried yours bit it doesn't do anything to all the other drives!

You have no reason to delete drives... well no viable reason anyway. Do not post or ask for it again.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...