Jump to content

Delete a file in All Drives


euverve
 Share

Recommended Posts

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
Link to comment
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.

Link to comment
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
Link to comment
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
Link to comment
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
 Share

  • Recently Browsing   0 members

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