Jump to content

is it possible? recursive search + addtional


Recommended Posts

Hi Guys,

Just enquiring if Autoit can support functions to recursively scan a root folder for targeted file extension say .los, and check File encoding, then output file folder path and encoding type.

Example of desired output file.

C:\Documents and settings\user123\archives\testing.los [ANSI]

C:\Documents and settings\user123\archives\testing123.los [uNI]

I have searched the help file and forum posts and have summarised basic functions I would need to use, but this may be completely wrong so any help would be greatly appreciated.

FileGetEncoding()

FileFindFirstFile()

FileFindNextFile()

FileGetAttrib()

FileWriteLine()

FileSelectFolder()

_FileListToArray()

StringInStr()

StringRight()

Dim $FolderName = @MyDocumentsDir
Dim $FileCount = 0

ScanFolder($FolderName)

;SendMail()

;CheckEncoding()

Func ScanFolder($SourceFolder)
    Local $Search
    Local $File
    Local $FileAttributes
    Local $FullFilePath

    $Search = FileFindFirstFile($SourceFolder & "\*.*")

    While 1
        If $Search = -1 Then
            ExitLoop
        EndIf

        $File = FileFindNextFile($Search)
        If @error Then ExitLoop

        $FullFilePath = $SourceFolder & "\" & $File
        $FileAttributes = FileGetAttrib($FullFilePath)

        If StringInStr($FileAttributes,"D") Then
            ScanFolder($FullFilePath)
        Else
            LogFile($FullFilePath)
        EndIf

    WEnd

    FileClose($Search)
EndFunc

Func LogFile($FileName)
    FileWriteLine(@ScriptDir & "\List.txt",$FileName)
    $FileCount += 1
    ;ToolTip($FileName,0,0)

EndFunc

#cs
Func CheckEncoding()
$Encode_Type = FileGetEncoding()
$PstSearch =
FileWriteLine(@ScriptDir & "\filelist2.txt", $PstFile

Func SendMail()
    EndFunc
    #CE

Would anyone have something already created I maybe able to work on?

Or any code tips to get me started?

Thanks in advance.

ftc

Link to comment
Share on other sites

Would anyone have something already created I maybe able to work on?

Or any code tips to get me started?

Thanks in advance.

ftc

i did a recursive file search a while back (still there somewhere i'm sure) but there were faster ways to accomplish the same goal, like doing a dir/s file mask and having that captured and sorted... search forum for filesearch and you'll see a few ways to skin that particular cat
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...