Jump to content
Sign in to follow this  

Out Of Order Output

Recommended Posts


Hello fellas,

I'm having a little issue with order. This script works fine, the only problem is that it outputs the files out of order.(index10.htm,index10.htm,index11.htm,index2.htm)

I want the output to be in order(index1.htm,index2.htm,index2.htm......etc)

$sTotalFiles = _GetFileCount("D:\Documents and Settings\Taevon Jones\Desktop\Extracted Keywords\")
MsgBox(0,'Total Files',$sTotalFiles)
$Firstline = 'christmas greetings'
DirCreate('D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\'&$Firstline)
FileCopy('D:\Documents and Settings\Taevon Jones\Desktop\HOME-MASTER-PHP.htm', _
'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\'&$Firstline&'\index.htm',8)
For $i = 1 To $sTotalFiles
   FileCopy('D:\Documents and Settings\Taevon Jones\Desktop\PAGE-MASTER-PHP.htm', _
            'D:\Documents and Settings\Taevon Jones\My Documents\One a be HyperVRE Webpages\'&$Firstline& '\index' & $i & '.htm',8)

Func _GetFileCount($Directory)
    Local $sTotalFiles = 0

    $search = FileFindFirstFile($Directory&"*.*")
    If $search = -1 Then
        MsgBox(0, "Error", "No files/directories matched the search pattern")

    While 1
        $file = FileFindNextFile($search)
        If @error Then ExitLoop
        $attrib = FileGetAttrib($Directory&$file)
        If StringInStr($attrib,"D") < 1 Then
            $sTotalFiles = $sTotalFiles+1

    Return $sTotalFiles

Share this post

Link to post
Share on other sites
Richard Robertson

It's technically correct. Parsing the number order is a lot more complicated. You'll have to pull out the number as a value and compare it to other files that have the same character text and number location.

The standard text sort would only work if the files have numbers like 01, 02, 03, ..., 10, 11, etc.

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.