Jump to content
Sign in to follow this  
euverve

Delete files in all drives that is specified in .ini file

Recommended Posts

euverve

How could i delete files in all drives (may exist or not)? This file is specified in my .ini file.

So that I want to delete a certain file, i just add it to my .ini file. Thanks...

Share this post


Link to post
Share on other sites
euverve

IniRead() and FileDelete()

How about applying to all drives?

Share this post


Link to post
Share on other sites
euverve

Use a loop to loop through the drives.

Any body could improve my code? Thanks

----------------------------------------------------------------

$DISK = DriveGetDrive("ALL") & "\"

$files = IniReadSection("deletefiles.ini", "Files")

$del = $DISK & $files

If @error Then

MsgBox(4096, "", "Error occured, probably no INI file.")

Else

For $I = 1 To $del [0]

$STATS = DriveStatus($DISK[$I])

If $STATS = "READY" Then

FileSetAttrib($del[$I], "-RSH+N")

FileDelete($del[$I])

EndIf

Next

EndIf

----------------------------------------------------------------

Any suggestions, thanks

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  

×