E1M1 Posted April 17, 2009 Share Posted April 17, 2009 (edited) This script I made don't list most directory's files for example it don't list files in c:\windows\system32, however it lists files in c:\windows\ime, Why this script dont list files in c:\windows\system32 ? My objective is make script that list all files in directory and if directory have any sub directories then it must also list files in subdirectories.In otherwords I need script that generates full directory tree since given directory,script that reveal whole directory tree. Edit: code updated, I invented how to list files in system32, but I still need help with making it more dynamic.At the moment sctipt list files like \maindir\subdir\file.ext but directory structure is not fixed, which mean it could also be \maindir\file.ext or \maindir\subdir1\subdir2\N number of directories\file.ext and all these directories may or may not contain files, if directory contain files, files must be added in list. #include <File.au3> $alltext = "" $path = "C:\windows" $flist = _FileListToArray($path, "*", 2) For $i = 1 To $flist[0] $alltext = $alltext & $path & "\" & $flist[$i] & @CRLF $newpath = $path & "\" & $flist[$i] $flist4 = _FileListToArray($path & "\" & $flist[$i], "*", 1) If Not @error Then For $b = 1 To $flist4[0] $alltext = $alltext & $path & "\" & $flist[$i] & "\" & $flist4[$b] & @CRLF Next EndIf $flist2 = _FileListToArray($path & "\" & $flist[$i], "*", 2) If Not @error Then For $n = 1 To $flist2[0] $alltext = $alltext & $path & "\" & $flist2[$n] & @CRLF $flist3 = _FileListToArray($path & "\" & $flist2[$n], "*", 1) If Not @error Then For $a = 1 To $flist3[0] $alltext = $alltext & $path & "\" & $flist2[$n] & "\" & $flist3[$a] & @CRLF Next EndIf Next EndIf Next ClipPut($alltext) Edited April 17, 2009 by E1M1 edited Link to comment Share on other sites More sharing options...
Authenticity Posted April 17, 2009 Share Posted April 17, 2009 Look here -> http://www.autoitscript.com/forum/index.ph...mp;hl=recursiveTo make your function search arbitrary depth of sub directories you'll need to use recursive, otherwise it'll go only to the most inner loop there is. Link to comment Share on other sites More sharing options...
E1M1 Posted April 18, 2009 Author Share Posted April 18, 2009 thanks edited 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