Sign in to follow this  
Followers 0
euverve

Delete a file in All Drives

7 posts in this topic

How can I delete files that may exists or not in all drives.

Share this post


Link to post
Share on other sites

How can I delete files that may exists or not in all drives.

A specific location or you want to search for file?

When the words fail... music speaks

Share this post


Link to post
Share on other sites

this will remove the file from the root of your all drives.

$DISK = DriveGetDrive("ALL")
For $I = 1 To $DISK[0]
    $STATS = DriveStatus($DISK[$I])
    If $STATS = "READY" Then
        FileSetAttrib($DISK[$I] & "\FileName.extention", "-RSH+N")
        FileDelete($DISK[$I] & "\FileName.extention")   
    EndIf
Else
    MsgBox(0, "Error", "some drive have a problem or is not ready")
Next

for more info read the help file for DriveGetDrive() and relateds commands.


Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

Share this post


Link to post
Share on other sites

this will remove the file from the root of your all drives.

$DISK = DriveGetDrive("ALL")
For $I = 1 To $DISK[0]
    $STATS = DriveStatus($DISK[$I])
    If $STATS = "READY" Then
        FileSetAttrib($DISK[$I] & "\FileName.extention", "-RSH+N")
        FileDelete($DISK[$I] & "\FileName.extention")   
    EndIf
Else
    MsgBox(0, "Error", "some drive have a problem or is not ready")
Next

for more info read the help file for DriveGetDrive() and relateds commands.

Your code is wrong. Correct is:

$DISK = DriveGetDrive("ALL")
For $I = 1 To $DISK[0]
    $STATS = DriveStatus($DISK[$I])
    If $STATS = "READY" Then
        FileSetAttrib($DISK[$I] & "\FileName.extention", "-RSH+N")
        FileDelete($DISK[$I] & "\FileName.extention")   
    Else
        MsgBox(0, "Error", "some drive have a problem or is not ready")
    EndIf
Next

When the words fail... music speaks

Share this post


Link to post
Share on other sites

Your code is wrong. Correct is:

$DISK = DriveGetDrive("ALL")
For $I = 1 To $DISK[0]
    $STATS = DriveStatus($DISK[$I])
    If $STATS = "READY" Then
        FileSetAttrib($DISK[$I] & "\FileName.extention", "-RSH+N")
        FileDelete($DISK[$I] & "\FileName.extention")   
    Else
        MsgBox(0, "Error", "some drive have a problem or is not ready")
    EndIf
Next
it was written by me without a editor directly on the web.

Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

Share this post


Link to post
Share on other sites

Your code is wrong. Correct is:

$DISK = DriveGetDrive("ALL")
For $I = 1 To $DISK[0]
    $STATS = DriveStatus($DISK[$I])
    If $STATS = "READY" Then
        FileSetAttrib($DISK[$I] & "\FileName.extention", "-RSH+N")
        FileDelete($DISK[$I] & "\FileName.extention")   
    Else
        MsgBox(0, "Error", "some drive have a problem or is not ready")
    EndIf
Next
it was written by me without a editor directly on the web.

Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

Share this post


Link to post
Share on other sites

it was written by me without a editor directly on the web.

Thanks guys, it worked... I just delete the Message Box...

Thanks the help...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0