Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Progressbar for file/folder delete to stop GUI hang

$
0
0
In my programm i need to delete folders/files and show the user about progress. Though it can can easily be done with FileDelete and DirRemove (without progress), the problem comes when the folder/file size is larger.It hanges the main gui completely. I searched the forum and found a script which deletes files one by one. However the script does not work properly. It does not delete all the files and folders. Once the script complete then i have to provide admin rights to delete remaining folder/files. Here is the script i am trying to use:-

[ autoit ]      
$DIR = "path\to\folder" If Not @error Then     $FILE = _FileListToArray($DIR)     If IsArray($FILE) Then         Dim $PATH[5]         ProgressOn("Removing "& $SEARCH,$DIR)         For $INDEX = 1 To $FILE[0]             ProgressSet($INDEX*100/$FILE[0],$FILE[$INDEX])             _PathSplit($DIR & "\" & $FILE[$INDEX],$PATH[1],$PATH[2],$PATH[3],$PATH[4])             If $PATH[4] <> "" Then                 FileDelete($DIR & "\" & $FILE[$INDEX])             Else                 DirRemove($DIR & "\" & $FILE[$INDEX],1)             EndIf             Sleep(250)         Next         ProgressOff()     EndIf EndIf


I also need to remove the folder where $DIR points to.

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>