mr-es335 Posted December 9, 2023 Posted December 9, 2023 @echo off ::---------------- set oldPath=D:\Main\ set folders=(First Second Third Fourth Fifth) ::---------------- for %%f in %folders% do ( if exist %oldPath%%%f\ rd %oldPath%%%f\ /q /s echo Removed: %oldPath%%%f\ ) echo Cleaning folders completed... ::---------------- I have this... ;----------------------------------------------- #include <AutoItConstants.au3> ;----------------------------------------------- ;Non-Loop Version _DeleteFolders ;----------------------------------------------- Func _DeleteFolders() Local $oldPath = "D:\Main" Local $folder1 = "First" Local $folder2 = "Second" Local $folder3 = "Third" Local $folder4 = "Fourth" Local $folder5 = "Fifth" ;----------------------------------------------- DirRemove($oldPath & "\" & $folder1, $DIR_REMOVE) DirRemove($oldPath & "\" & $folder2, $DIR_REMOVE) DirRemove($oldPath & "\" & $folder3, $DIR_REMOVE) DirRemove($oldPath & "\" & $folder4, $DIR_REMOVE) DirRemove($oldPath & "\" & $folder5, $DIR_REMOVE) SplashTextOn("Notice!", "Cleaning folders completed...", 350, 50, -1, -1) Sleep(2000) EndFunc ;==>_DeleteFolders ;----------------------------------------------- mr-es335 Sentinel Music Studios
somdcomputerguy Posted December 9, 2023 Posted December 9, 2023 Study in the documentation arrays and the For..Next loop. argumentum 1 - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
Solution ioa747 Posted December 9, 2023 Solution Posted December 9, 2023 like #include <AutoItConstants.au3> Local $oldPath = "D:\Main" Local $afolders = "First, Second, Third, Fourth, Fifth" $afolders = StringSplit($afolders, ", ", 1) For $i = 1 To $afolders[0] ;DirRemove($oldPath & "\" & $afolders[$i], $DIR_REMOVE) ConsoleWrite("-> Remove: " & $oldPath & "\" & $afolders[$i] & @CRLF) Next mr-es335 1 I know that I know nothing
mr-es335 Posted December 9, 2023 Author Posted December 9, 2023 (edited) somdcomputerguy, Thanks for the suggestions. I did look at both of these suggestions, and neither - at least to me anyhow, were of any real assistance. Edited December 9, 2023 by mr-es335 mr-es335 Sentinel Music Studios
mr-es335 Posted December 9, 2023 Author Posted December 9, 2023 ioa747, ...like..."Yes!"...Very much so! Thanks for this, ioa747...very much appreciated! Note: Regarding the HelpFile, though that text can at times, indeed be Help-Full, lack of various examples is also, sorely lacking! The example that ioa747 provided not only displays what I would refer to as "a practical example", but also display "other things" that makes further investigation extremely likely! For example: 1) Local $afolders = "First, Second, Third, Fourth, Fifth": Shows an interesting usage of multiple variables. 2) How to apply a For...To-..Next command 3) A practical use of StringSplit 4) A practical application of "other commands" - instead of focusing entirely on the use of Msgbox's. As a "point-of-interest", instruction should never, ever be "assumptive". Just because one "gets it"...should NOT infer or imply that someone else is going to "gets it" as well. A wise instructor takes a hand and then opens the heart. Without sounds too corny, ioa747 has certainly opened this heart! Thanks ioa747! mr-es335 Sentinel Music Studios
somdcomputerguy Posted December 9, 2023 Posted December 9, 2023 (edited) I posted an example here that doesn't work. Edited April 11, 2024 by somdcomputerguy I posted an example here that doesn't work. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
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