Marlo Posted September 27, 2008 Posted September 27, 2008 Hello again! i have run into yet another snag. You see my script needs to search a folder and its subfolders for all files and i have been using the following code: Func _SearchFolder($folder) $files = _FileListToArray($folder,"*",1) $folders = _FileListToArray($folder,"*",2) _FileFunc($files,$folder) _FolderFunc($folders,$folder) EndFunc Func _FileFunc($files,$folder) For $i = 1 To UBound($files)-1 DO STUFF Next EndFunc Func _FolderFunc($folders,$parentdir) For $i = 1 To UBound($folders)-1 _SearchFolder($parentdir & "\" & $folders[$i]) Next EndFunc But i dont want it to have to call and recall the _Searchfolder function as it fudges up some stuff that i have in mind. So is there any way i can either compress my current code into one function or just rewrite a better way of doing it? Help is greatly apreciated. ciao Click here for the best AutoIt help possible.Currently Working on: Autoit RAT
Valuater Posted September 27, 2008 Posted September 27, 2008 That's exactly what this program does.. and you can search for a word or phrase inside a file, or the titlehttp://www.autoitscript.com/forum/index.ph...st&p=141335or..... maybe there is some code you would like to use in there8)
AdmiralAlkex Posted September 27, 2008 Posted September 27, 2008 You could do something like this: #Include <File.au3> _SearchFolder("R:\") Func _SearchFolder($folder) $files = _FileListToArray($folder,"*") For $X = 1 To $files[0] If StringInStr(FileGetAttrib($folder & $files[$X]), "D") Then ;Do something when it is a folder, perhaps calling _SearchFolder() again?;) Else ;Do something else when it is a file EndIf Next EndFunc .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
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