Opened on Jun 13, 2012 at 10:55:25 PM
Closed on Aug 1, 2014 at 8:18:06 PM
#2221 closed Feature Request (Rejected)
FileDelete() @error values
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | Severity: | None | |
| Keywords: | Cc: |
Description
Request to have FileDelete() return an @error value.
Currently, FileDelete() only returns 0 if fails. If you are attempting to recursively delete files from multiple folders (say they are multiple dump folders) where some may have files and some may be empty altogether, it just returns 0.
The problem with this is that you can't know if it exited because there was a protected (locked) file that couldn't be deleted, or there was simply no file to be found. It would be nice to have @error values set upon function return.
Example @error values
0 = Successful
1 = Could Not Delete Files (Protected/Locked)
2 = Path or File does not exist (includes empty folders upon recursive use)
Attachments (0)
Change History (3)
follow-up: 2 comment:1 by , on Feb 27, 2013 at 2:49:41 PM
comment:2 by , on Apr 19, 2013 at 2:19:16 PM
Replying to Exit:
At least return a @error at all.
Here a function to do the job:
Func _FileDelete($sFile)
$sFile = DllCall('kernel32.dll', 'int', 'DeleteFileW', 'wstr', $sFile)
Return SetError(Not $sFile[0], 0, $sFile[0])
EndFunc ;==>_FileDelete
THat's not what is requested.
to have the differention _WinAPIGetLastError() must be called which can be done even after calling the standard FileDelete()
comment:3 by , on Aug 1, 2014 at 8:18:06 PM
| Resolution: | → Rejected |
|---|---|
| Status: | new → closed |
The user should check that the required deletions have taken place, not AutoIt.
Rejected.
M23

At least return a @error at all.
Here a function to do the job:
Func _FileDelete($sFile)
EndFunc ;==>_FileDelete