Jump to content

List all folder and subfolder


Recommended Posts

Hello i need to list all folder under a folder and get each path to then check if a name is in the path

Here is the code i have 

 

#include <file.au3>
#include <array.au3>

$PathConstats = IniRead(@ScriptDir & "\Clean_Up_Constats_Photos.ini","Path","1","")
$ArrayFolders = _FileListToArrayRec($PathConstats,"*",$FLTAR_FOLDERS ,1)

 

now i can show this with this line of code

_ArrayDisplay($ArrayFolders, "Sorted tree")

 

But i need to check every path to search for a certain string and then delete the folder and all subfolder and sub files if that sting is found

 

Can someone help me please

 

Thanks !

Link to comment
Share on other sites

Use either a for...next or for...in...next loop to interate through the array indicies

For $iX = 1 to UBound($ArrayFolders)-1
     ;...
Next

;or

For $sDir in $ArrayFolders
     ;...
Next

Use StringInstr to determine if a string contains a desired substring

If StringInstr($ArrayFolders[$iX], "substring") Then
     ;....
EndIf

;or

If StringInstr($sDir, "substring") Then
     ;....
EndIf

Use DirRemove to delete a directory

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