Sign in to follow this  
Followers 0
Pignara

Help to create a filelist

6 posts in this topic

Hi,

I need to create an output.lst file from a log folder.

The output.lst must have this format:

filename;Patch|Size

like

recovery.log;C:\Recovery\Log\|1276

log_06.03.2007.txt;C:\Recovery\Log\|1800

I figured out how to output the filelist

#NoTrayIcon
Dim $Logdir = @ScriptDir & '\Logs\'

$LogFolders = _FileListToArrayEx($Logdir, '*.log; *.txt; *.rtf')
    
      $s_FileList = _ArrayToString($LogFolders, "*",1)
      $a_FileList = StringSplit($s_FileList, "*")
      $s_OutFile = @ScriptDir & '\output.lst'
      _FileWriteFromArray($s_OutFile, $a_FileList)

but I'm stuck adding Patch & Size to each line...

Any help is really appreciate

Share this post


Link to post
Share on other sites



Try this (change the path, of course, and run it in scite):

$path = @MyDocumentsDir & '\'
$first = FileFindFirstFile($path & '*.*')

While 1
    $next = FileFindNextFile($first)
    If @error Then ExitLoop
    If StringInStr(FileGetAttrib($path & $next), 'D') Then ContinueLoop
    ConsoleWrite($next & ';' & $path & '|' & FileGetSize($path & $next) & @LF)
WEnd

Share this post


Link to post
Share on other sites

Try this (change the path, of course, and run it in scite):

$path = @MyDocumentsDir & '\'
$first = FileFindFirstFile($path & '*.*')

While 1
    $next = FileFindNextFile($first)
    If @error Then ExitLoop
    If StringInStr(FileGetAttrib($path & $next), 'D') Then ContinueLoop
    ConsoleWrite($next & ';' & $path & '|' & FileGetSize($path & $next) & @LF)
WEnd
Tested in scite, all went fine.

I'am an NOOB ans say me that I'm stupid but how can "fisically" create the output.lst? :whistle:

Share this post


Link to post
Share on other sites

FileClose(FileOpen('Output.lst', 2))


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.

Share this post


Link to post
Share on other sites

FileClose(FileOpen('Output.lst', 2))

I don't understand. Please show me a sample script that create and write the output.lst.

Share this post


Link to post
Share on other sites

I don't understand. Please show me a sample script that create and write the output.lst.

It creates a file.

Then you use FileWrite to write to the file.

Look at FileWrite in the help file for the example.


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.

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  
Followers 0