Jump to content

FileDelete and/or DirRemove with output


Recommended Posts

Is it possible to use FileDelete and/or DirRemove AND have the files/folders that are deleted by these commands written to a log file.

So, if I have DirRemove(@TempDir, 1) I want to be able to capture all the files that were deleted and save it to a log.

Any help would be greatly appreciated...

Link to comment
Share on other sites

_FileListToArray + FileDelete + _FileWriteLog

_FileListToArray + FileDelete are no problem.

Can you give me an example of how I would use _FIleWriteLog in conjuction with those commands?

I know this can be done in DOS, just trying to make it work in AutoIt...

Edited by erik7426
Link to comment
Share on other sites

_FileListToArray + FileDelete are no problem.

Then I guess you can get this to work :P

; .... $aArray is the file list ....
For $i = 1 To UBound($aArray) - 1 
If FileDelete($aArray[$i]) Then 
    _FileWriteLog("mylog.txt", 'Deleted file: "' & $aArray[$i] & '"')
Else
    _FileWriteLog("mylog.txt", 'Unable to delete file: "' & $aArray[$i] & '"')
EndIf
Next

Edit: Loop

Edited by Robjong
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...