Sign in to follow this  
Followers 0
supportvb

List all folder and subfolder

3 posts in this topic

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 !

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Ok Thanks for your help ! It's working 

 

Edited by supportvb

Share this post


Link to post
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
Sign in to follow this  
Followers 0