mr-es335 Posted Monday at 06:05 PM Share Posted Monday at 06:05 PM (edited) Good day, A query...if I may..."Can _FileListToArray not be deployed in the same manner as _FileListToArrayRec?" For example...from this... #include <Constants.au3> #include <File.au3> example() Func example() Local $aFiles[0] $aFiles = _FileListToArrayRec("C:\RML\SAC\VST_PlugIns", "*", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) For $i = 1 To $aFiles[0] FileDelete($aFiles[$i]) Next EndFunc ;==>example ...to this... #include <Constants.au3> #include <File.au3> example() Func example() Local $aFiles[0] $aFiles = _FileListToArray("C:\RML\SAC\VST_PlugIns", "*", $FLTAR_FILES) For $i = 1 To $aFiles[0] FileDelete($aFiles[$i]) Next EndFunc ;==>example The former works, whilst the latter does not work. Thanks! Edited Monday at 06:06 PM by mr-es335 mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
Andreik Posted Monday at 06:41 PM Share Posted Monday at 06:41 PM _FileListToArrayRec() search recursively for files in subdirectories and _FileListToArray() does not. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
mr-es335 Posted Monday at 07:42 PM Author Share Posted Monday at 07:42 PM ioa747, What if I do not need to perform a recursive operation? For whatever reason, I cannot get the _FileListToArray() to work!!! Any ideas? mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
water Posted Monday at 08:38 PM Share Posted Monday at 08:38 PM What does "does not work" exactly mean? Do you get no result, missing data, error code ...? The more information you can provide the easier it is for us to help you My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
mr-es335 Posted Monday at 09:15 PM Author Share Posted Monday at 09:15 PM water, This example does absolutely nothing! #include <Constants.au3> #include <File.au3> example() Func example() Local $aFiles[0] $aFiles = _FileListToArray("C:\RML\SAC\VST_PlugIns", "*", $FLTAR_FILES) For $i = 1 To $aFiles[0] FileDelete($aFiles[$i]) Next EndFunc ;==>example mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
ioa747 Posted Monday at 09:20 PM Share Posted Monday at 09:20 PM (edited) in the former you have the parameter $FLTAR_FULLPATH in the latter not and you don't give proper path FileDelete("C:\RML\SAC\VST_PlugIns\" & $aFiles[$i]) Edit: try and you will see #include <Constants.au3> #include <File.au3> example() Func example() Local $aFiles[0] $aFiles = _FileListToArray("C:\RML\SAC\VST_PlugIns", "*", $FLTAR_FILES) For $i = 1 To $aFiles[0] ;~ FileDelete($aFiles[$i]) ConsoleWrite($i & ") FileDelete: " & $aFiles[$i] & @CRLF) Next EndFunc ;==>example Edit: The right would be with $bReturnPath = True #include <Constants.au3> #include <File.au3> example() Func example() Local $aFiles[0] ;_FileListToArray ( $sFilePath [, $sFilter = "*" [, $iFlag = $FLTA_FILESFOLDERS [, $bReturnPath = False]]] ) $aFiles = _FileListToArray("C:\RML\SAC\VST_PlugIns", "*", $FLTAR_FILES, True) For $i = 1 To $aFiles[0] ;~ FileDelete($aFiles[$i]) ConsoleWrite($i & ") FileDelete: " & $aFiles[$i] & @CRLF) Next EndFunc ;==>example or without $bReturnPath = True which entails with $bReturnPath = False #include <Constants.au3> #include <File.au3> example() Func example() Local $aFiles[0] ;_FileListToArray ( $sFilePath [, $sFilter = "*" [, $iFlag = $FLTA_FILESFOLDERS [, $bReturnPath = False]]] ) $aFiles = _FileListToArray("C:\RML\SAC\VST_PlugIns", "*", $FLTAR_FILES) For $i = 1 To $aFiles[0] ;~ FileDelete($aFiles[$i]) ConsoleWrite($i & ") FileDelete: " & "C:\RML\SAC\VST_PlugIns\" & $aFiles[$i] & @CRLF) Next EndFunc ;==>example which could also be done with _FileListToArrayRec with changing the parameter $iRecur from $FLTAR_RECUR to FLTAR_NORECUR #include <Constants.au3> #include <File.au3> example() Func example() Local $aFiles[0] $aFiles = _FileListToArrayRec("C:\RML\SAC\VST_PlugIns", "*", $FLTAR_FILES, $FLTAR_NORECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) For $i = 1 To $aFiles[0] FileDelete($aFiles[$i]) Next EndFunc ;==>example Edited Monday at 11:18 PM by ioa747 I know that I know nothing Link to comment Share on other sites More sharing options...
water Posted Monday at 09:37 PM Share Posted Monday at 09:37 PM One of my coding rules is to check the return value or error code after each call of an AutoIt function. FileDelete returns 1 on success and 0 if there was a problem. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
ioa747 Posted Monday at 11:19 PM Share Posted Monday at 11:19 PM 3 hours ago, mr-es335 said: ioa747, What if I do not need to perform a recursive operation? check again https://www.autoitscript.com/forum/topic/212281-_filelisttoarray-versus-_filelisttoarrayrec/#comment-1536873 I know that I know nothing 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