Sign in to follow this  
Followers 0
Berkeley

Read file list in as an array

2 posts in this topic

So new to this I dont even know how to ask for help so please only minor flogging :graduated:

So I have a list of files that I need to open and perform a bunch of repetitive tasks on. I have figured out the script for opening a file and automating the tasks. What I would like to do is load the list of files in as an array and then have autoit perform the tasks for each file in the list. I found _FileReadToArray but cannot get it to work. My text file would look like:

c:\file\fileX.txt

c:\file\fileX.txt

c:\file\fileX.ttx

and so on

perhaps SQlite is my solution. I have not looked at that yet. It does seem wrong to load all of the list to memory so perhaps there is a better way.

Thanks,

Berkeley

Share this post


Link to post
Share on other sites



Quote from help file:

_FileListToArray

--------------------------------------------------------------------------------

Lists files and\or folders in a specified path (Similar to using Dir with the /B Switch)

#Include <File.au3>

_FileListToArray($sPath [, $sFilter = "*" [, $iFlag = 0]])

Parameters

$sPath Path to generate filelist for.

$sFilter [optional] the filter to use, default is *. Search the Autoit3 helpfile for the word "WildCards" For details.

$iFlag [optional] specifies whether to return files folders or both

$iFlag=0(Default) Return both files and folders

$iFlag=1 Return files only

$iFlag=2 Return Folders only

Return Value

Success: an Array, see remarks

Failure: 0

@Error: 1 = Path not found or invalid

2 = Invalid $sFilter

3 = Invalid $iFlag

4 = No File(s) Found

Remarks

The array returned is one-dimensional and is made up as follows:

$array[0] = Number of Files\Folders returned

$array[1] = 1st File\Folder

$array[2] = 2nd File\Folder

$array[3] = 3rd File\Folder

$array[n] = nth File\Folder


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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