Sign in to follow this  
Followers 0
VIP

How to find and list files/folders (include subdirectories) ?

6 posts in this topic

For example, the folders and files tree follows:

(folder)- C:\FolderName
( file ) -- SysAnti.exe
(folder) -- SubDir1
( file )     --- File1.Ext
( file )     --- Filex.exe
( file )     --- Filen.tmp
(folder) -- SubDir2
( file )     --- Forever.exe
( file )     --- SysAnti.exe
( file )     --- Autorun.inf
(folder) -- SubDirn
( file )     --- cFile1.Ext
( file )     --- cFilex.exe
(folder)     --- C:\FolderName\SubDirn
(folder)     --- SubofSubDir1
( file )         ---- dFile1.Ext
( file )         ---- dFilex.exe
( file )         ---- dFilen.tmp
(folder)         ---- SysAnti
(folder)     --- Forever
( file )         ---- SysAnti.abv
(folder)     --- SysAntiAutorunSysAnti
( file )         ---- Forever
( file )         ---- SysAnti
( file )         ---- Autorun

I want to find all files and Folders name "SysAnti" in folder C:\FolderName (Including subfolders!)

$a= _FindIt( "C:\FolderName","SysAnti","File=1","Folder=0","Subdir=1")
    ConsoleWrite($a & @CRLF)

-> Return:

C:\FolderName\SysAnti.exe

C:\FolderName\SubDir2\SysAnti.exe

C:\FolderName\SubDirn\Forever\SysAnti.abv

C:\FolderName\SubDirn\SysAntiAutorunSysAnti

C:\FolderName\SubDirn\SubofSubDir1\SysAnti

C:\FolderName\SubDirn\SysAntiAutorunSysAnti\SysAnti

I want to find all files name "SysAnti" with any file extension in folder C:\FolderName (Including subfolders!)

$a= _FindIt( "C:\FolderName","SysAnti.*","File=1","Folder=0","Subdir=1")
    ConsoleWrite($a & @CRLF)

-> Return:

C:\FolderName\SysAnti.exe

C:\FolderName\SubDir2\SysAnti.exe

C:\FolderName\SubDirn\Forever\SysAnti.abv

C:\FolderName\SubDirn\SysAntiAutorunSysAnti\SysAnti

I want to find all files name "SysAnti" with any file extension in folder C:\FolderName (NO Including subfolders!)

$a= _FindIt( "C:\FolderName","SysAnti.*","File=1","Folder=0","Subdir=0")
ConsoleWrite($a & @CRLF)

-> Return:

C:\FolderName\SysAnti.exe

I want to find all files name "SysAnti" with extension ".exe" in folder C:\FolderName (Including subfolders!)

$a= _FindIt( "C:\FolderName","SysAnti.exe","File=1","Folder=0","Subdir=1")
ConsoleWrite($a & @CRLF)

-> Return:

C:\FolderName\SysAnti.exe

C:\FolderName\SubDir2\SysAnti.exe

I want to find all files name "SysAnti" with extension ".exe" in folder C:\FolderName (NO Including subfolders!)

$a= _FindIt( "C:\FolderName","SysAnti.exe","File=1","Folder=0","Subdir=0")
ConsoleWrite($a & @CRLF)

-> Return:

C:\FolderName\SysAnti.exe

I want to find all Folders name "SysAnti" in folder C:\FolderName (Including subfolders!)

$a= _FindIt( "C:\FolderName","SysAnti","File=0","Folder=1","Subdir=1")
ConsoleWrite($a & @CRLF)

-> Return:

C:\FolderName\SubDirn\SubofSubDir1\SysAnti

I want to find all Folders name "*SysAnti" in folder C:\FolderName (Including subfolders!)

$a= _FindIt( "C:\FolderName","SysAnti","File=0","Folder=1","Subdir=1")
ConsoleWrite($a & @CRLF)

-> Return:

C:\FolderName\SubDirn\SubofSubDir1\SysAnti

C:\FolderName\SubDirn\SysAntiAutorunSysAnti

Func _FindIt($1,$2,$3,$4,$5)
???
EndFunc

So, how to write Func _FindIt ???

What is the content of _FindIt ???

Help me to finish it :)


Regards,
 

Share this post


Link to post
Share on other sites



Trong,

My RecFileListToArray UDF will do exactly what you want - the link is in my sig. please ask if you have any trouble getting it to work as you require. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thank you Melba23 !

I'll try it right now!


Regards,
 

Share this post


Link to post
Share on other sites

Excellent!

Although the UDF too many lines! ^ ^

and have little problem with Func BitAnd, but it was solved with the standard version of AutoIt!


Regards,
 

Share this post


Link to post
Share on other sites

Trong,

Although the UDF too many lines!

Please do not start down that road as well - I get quite enough of that from Tlem and Spiff59! :D

If you want a UDF that is as flexible and comprehensive as I believe that one to be, it is going to take a fair few lines of code. Anyway all you need in your own script is a single #include line. ;)

But I am glad you found it useful and that it did what you wanted. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

You're funny, I like you! :guitar: ^^ Thank you very much! :ILA2:


Regards,
 

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