Jump to content

Directory structure file


Recommended Posts

Hi!

I want to create a script to download programs from the internet via the given link to it.

I've created a "directory structure file" to arrange files (links) into folders, so it would be more see through.

The structure looks like this (filestruct.txt):

DirectoryName
.SubDirName
..FileName
...-link
...-mirror
..FileName
...-link
DirectoryName2
.FileName
..-link
.SubDirName
..FileName
...-link

I jump through the lines with FileReadLine.

I use StringRegExp, to determinate the type of the current line (dir,subdir,file,link).

But I have no idea how can I store it in a dinamical array.

If I want to store it in an array, then I need at least a 5D array.

I afraid that if I would use ReDim for every line, after some it would be slower and slower, if I add more and more files to it.

Anyone knows another method for this, or to keep it fast? Maybe an already existing method to store a structure like this?

And here is a simple 5D array declaration error:

Dim $a1[1][1][1][1] = [[[[1]]]] ;Good
Dim $a2[1][1][1][1][1] = [[[[[1]]]]] ;syntax & wrong nesting error
Link to comment
Share on other sites

Try to combine array and structure.

I've not tested this, but i think i'ts possible.

I know, that structure not so fast like an array.

Dim $tagStructure = "wchar dir[1024];wchar sub[1024];wchar file[256];wchar link[1024];wchar mirror[1024]"
Dim $aStuff[1000]
For $i = 0 To UBound($aStuff) -1
    $aStuff[$i] = DllStructCreate($tagStructure)
Next

; set data for current value
DllStructSetData($aStuff[$current], 'dir', 'the_directory')
DllStructSetData($aStuff[$current], 'sub', 'the_subdirectory')
DllStructSetData($aStuff[$current], 'file', 'the_file')
DllStructSetData($aStuff[$current], 'link', 'the_link')
DllStructSetData($aStuff[$current], 'mirror', 'the_mirror')

Best Regards BugFix  

Link to comment
Share on other sites

  • Developers

You need a 5 d array to store this ? what is wrong with using a 2d array?

Anyways how did you figure that the first line is correct because it isn't?

Dim $a1[1][1][1][1] = [[[[1]]]] ;Good 
Dim $a2[1][1][1][1][1] = [[[[[1]]]]] ;syntax & wrong nesting error

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...