masvil Posted February 18, 2006 Share Posted February 18, 2006 What FileFindNextFile func does mean for "next"? How can I choise criteria order (name, date, size etc.)? Help and search in forum doesn't help me Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 18, 2006 Moderators Share Posted February 18, 2006 Stick all that information into an array? That sounds like it would take an awfully long time... maybe someone has something with using dos or something Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
greenmachine Posted February 18, 2006 Share Posted February 18, 2006 "Returns a filename according to a previous call to FileFindFirstFile." Look up FileFindFirstFile as well. Link to comment Share on other sites More sharing options...
masvil Posted February 18, 2006 Author Share Posted February 18, 2006 Look up FileFindFirstFile as well.FileFindFirstFile defines a file search string, a kind of "filter". My question is: in which order does FileFindNextFile process files filtered by FileFindFirstFile? Link to comment Share on other sites More sharing options...
greenmachine Posted February 18, 2006 Share Posted February 18, 2006 Oh, now I understand your question. My guess, since I'm not 100% certain, would be that it finds the first file that matches your criteria starting at the base location, and then goes file by file and folder by folder until it has searched through the entire base directory. Link to comment Share on other sites More sharing options...
Valuater Posted February 18, 2006 Share Posted February 18, 2006 maybe take a look at thishttp://www.autoitscript.com/forum/index.php?showtopic=21830#not sure... but it may help8) Link to comment Share on other sites More sharing options...
masvil Posted February 18, 2006 Author Share Posted February 18, 2006 (edited) Oh, now I understand your question.Not yet Example: FileFindFirstFile matches these 3 files:- 1.txt (70k)- 2.txt (18k)- 3.txt (90k)How can I make FileFindNextFile processes them in size order (3.txt then 1.txt then 2.txt) instead of name order (even if I still haven't understood which is default order)?I hope I've been clearer.@Valuater: not so much Edited February 18, 2006 by masvil Link to comment Share on other sites More sharing options...
greenmachine Posted February 18, 2006 Share Posted February 18, 2006 Well it doesn't appear that FileFindNextFile does that. So to get the largest file, just use FileGetSize and compare. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 18, 2006 Moderators Share Posted February 18, 2006 (edited) Ya'll are going in circles on this subject, as I stated, you'd have to read all that information individually and store it into an array, then pull from it what specifically you are looking for. Or maybe someone can do it via a dos command or something, which would be much faster I'm sure. Edit: Example from help$search = FileFindFirstFile("*.*") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop MsgBox(4096, "File:", $file) WEnd ; Close the search handle FileClose($search) Put in that loop something like under $file-- $FileSize = $Filesize & FileGetSize($file) / 1024 & Chr(01) or something then StringSplit() it. Then you would work from the stringsplit for filesize. Edited February 18, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
masvil Posted February 19, 2006 Author Share Posted February 19, 2006 you'd have to read all that information individually and store it into an array, then pull from it what specifically you are looking for.OK, I'll try that way.However... strange that it's undocumented Link to comment Share on other sites More sharing options...
Valuater Posted February 19, 2006 Share Posted February 19, 2006 this will do the trick expandcollapse popup#Include <File.au3> #Include <Array.au3> Dim $Location = @DesktopDir & "\" $FileList = _FileListToArray ($Location) If (Not IsArray($FileList)) and (@error = 1) Then MsgBox(0, "", "No Files\Folders Found.") Exit EndIf Dim $Nfile[$FileList[0]] For $x = 1 To $FileList[0] -1 $Temp_info = FileGetSize($Location & $FileList[$x]) $Nfile[$x] = $Temp_info & "," & $FileList[$x] Next ArraySortNum($Nfile, 0) _ArrayDisplay($Nfile, " Files Sorted by Size") ; Author - SmOke_N Func ArraySortNum(ByRef $nArray, $Ascending = 0, $Start = 1) For $i = $Start To UBound($nArray) - 2 Local $SE = $i If $Ascending = 0 Then For $x = $i To UBound($nArray) - 1 If Number($nArray[$SE]) < Number($nArray[$x]) Then $SE = $x Next Else For $x = $i To UBound($nArray) - 1 If Number($nArray[$SE]) > Number($nArray[$x]) Then $SE = $x Next EndIf Local $HLD = $nArray[$i] $nArray[$i] = $nArray[$SE] $nArray[$SE] = $HLD Next EndFunc 8) Link to comment Share on other sites More sharing options...
masvil Posted February 19, 2006 Author Share Posted February 19, 2006 (edited) this will do the trickIt works great, thanx Anyway this question is still unanswered: in which order does FileFindNextFile process files filtered by FileFindFirstFile? Edited February 19, 2006 by masvil Link to comment Share on other sites More sharing options...
Valuater Posted February 19, 2006 Share Posted February 19, 2006 It works great, thanx Anyway this question is still unanswered: in which order does FileFindNextFile process files filtered by FileFindFirstFile?the first file found... then the second file found etc.. etc8) Link to comment Share on other sites More sharing options...
masvil Posted February 19, 2006 Author Share Posted February 19, 2006 (edited) the first file found... then the second file found etc.. etcHm, back to example.Example: FileFindFirstFile matches these 3 files:- 2.txt (18k)- 1.txt (70k)- 3.txt (90k)In which order (and why) FileFindNextFile find each of them? Edited February 19, 2006 by masvil Link to comment Share on other sites More sharing options...
pecloe Posted February 19, 2006 Share Posted February 19, 2006 i just did a quick and dirty test with 3 jpg files named 1,2 and 3. FileFindNextFile seems to find them in that order 1 2 3 regardless of size or date created. like i say quick and dirty. hope this helps answer your original question. Link to comment Share on other sites More sharing options...
ChrisL Posted February 19, 2006 Share Posted February 19, 2006 i just did a quick and dirty test with 3 jpg files named 1,2 and 3. FileFindNextFile seems to find them in that order 1 2 3 regardless of size or date created. like i say quick and dirty. hope this helps answer your original question.I would guess that they are copied in the order they are created and stored in the table of contents in windows.. I could be wrong though!! [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
pecloe Posted February 19, 2006 Share Posted February 19, 2006 i don't want to beat a dead horse here but here's what i did. created 3 jpg files. named them 123, creation times are in that order 12:50 12:51 12:52. FileFindNextFile listed them 123. i renamed file 1 to 3 and so on, FileFindNextFile still found them 123. of course when i renamed them did i change the modified date? i forgot to look. i'm really not sure what the answer is. Link to comment Share on other sites More sharing options...
greenmachine Posted February 19, 2006 Share Posted February 19, 2006 When I tried it, it found files alphabetically (as expected) no matter what. Link to comment Share on other sites More sharing options...
masvil Posted February 19, 2006 Author Share Posted February 19, 2006 Hm, actually we can say that order is alphabetical in any case and can't be changed. An UDF (or an official option) could be useful to go over that limit. 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