sundar Posted March 14, 2013 Share Posted March 14, 2013 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:- $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. Link to comment Share on other sites More sharing options...
sundar Posted March 14, 2013 Author Share Posted March 14, 2013 Any help please... Link to comment Share on other sites More sharing options...
bogQ Posted March 14, 2013 Share Posted March 14, 2013 #RequireAdmin from help file? TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
sundar Posted March 14, 2013 Author Share Posted March 14, 2013 The script is already running as admin using #RequireAdmin. I had to delete those folders manually. Link to comment Share on other sites More sharing options...
careca Posted March 14, 2013 Share Posted March 14, 2013 (edited) I would use Melba's "RecFileListToArray" since it can retrieve files and folders, you can specify the depth of the recursive function and some more stuff. Maybe the script lags because while it is deleting the big file it doesn't update the bar, same as saying it just hangs. Someone with higher knowledge step in and prove me wrong. EDIT: Oh btw add DirRemove($DIR,1) after the NEXT, that way, after it has found and deleted all files, it deletes the folder itself uppon exiting the loop. Next DirRemove($DIR,1) ProgressOff() Edited March 14, 2013 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
ur Posted June 3, 2015 Share Posted June 3, 2015 (edited) Are you importing any other AU3 files in your script. Because this script is not working for me.Ans also please tell if you got solution for this. Getting error @ $SEARCH and _PathSplit() as undefined global variable and function respectively. Please see the attached screenshot for reference. Edited June 3, 2015 by ur more info Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 3, 2015 Moderators Share Posted June 3, 2015 ur,Stop necroing every thread you can find about deletion progress bars - I have deleted all the others.As to your question about _PathSplit - why not look in the Help file and find out what include file you need for yourself?M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
ur Posted June 4, 2015 Share Posted June 4, 2015 (edited) These scripts might be helpful.For me , delete2.au3 is working, as I tested only it. Delete1.au3Delete2.au3Delete3.au3 But the issues is not solved as the script hangs when deleting large files. The below script is used by me before for copying files/folders with progress bar(windows default one).I found similar option for moving by using same object.But not able to find for delete.Can anyone provide for deleting. dml.vbs Edited June 4, 2015 by ur more info Link to comment Share on other sites More sharing options...
ur Posted June 4, 2015 Share Posted June 4, 2015 (edited) ur,Stop necroing every thread you can find about deletion progress bars - I have deleted all the others.As to your question about _PathSplit - why not look in the Help file and find out what include file you need for yourself?M23 @Melba23I am not waiting for these kind of sarcastic answers.Everyone in the forum knows about the help file.I am waiting for other people in forum who are willing to help.And more over if anyone write any piece of code in the forum, it doesn't mean that reader should investigate himself to get the dependency.It is only matter of two lines to show the #include lines in the post to save others time. Edited June 4, 2015 by ur S Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 4, 2015 Moderators Share Posted June 4, 2015 ur,I am not waiting for these kind of sarcastic answersNeither am I - and I suggest that you pay attention to what I said.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
ur Posted June 6, 2015 Share Posted June 6, 2015 (edited) Did anyone found a solution to stop the script to hang while deleting the files and folders. Edited June 6, 2015 by ur Link to comment Share on other sites More sharing options...
BrewManNH Posted June 6, 2015 Share Posted June 6, 2015 FileDelete and DirRemove will not return to the running script until they have finished deleting what you told them to, there's no workaround possible using those functions. You could do it using a Run command and the RMDIR command and/or the DEL commands from a console window, but you'd have to get feedback from those commands to determine if they've done what you wanted. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now