Jump to content
Sign in to follow this  
Ioannis

Delete all files from all drives

Recommended Posts

Ioannis

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?

Share this post


Link to post
Share on other sites
Anonymouse

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. :)

Share this post


Link to post
Share on other sites
Ioannis

i need for example if on my system there is drive d to delete all the files from the drive d

Share this post


Link to post
Share on other sites
TehWhale

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?

Share this post


Link to post
Share on other sites
Ioannis

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.

Share this post


Link to post
Share on other sites
Ioannis

if anyone can help it will be great pleasure for me!thanks

Share this post


Link to post
Share on other sites
TehWhale

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

Share this post


Link to post
Share on other sites
Ioannis

thanks a lot i will make some code using these functions and if i need help i will tell you!thanks again for your time!

Share this post


Link to post
Share on other sites
Danny35d

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

Share this post


Link to post
Share on other sites
TehWhale

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

Share this post


Link to post
Share on other sites
Ioannis

thank you so much! i dont have words to say.Thanks again for your time although i am reading the documentation of Autoit you post it firstly.so thanks a lot!

Share this post


Link to post
Share on other sites
Ioannis

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

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×