Jump to content

Dircreate with index in subfolders


Berti
 Share

Recommended Posts

Hi,

I want to create folders in a loop

The following loop ist working:

$dir[1]= "FolderA"

$dir[2]= "FolderB"

$dir[3]= "FolderC"

For $i=1 to 3

DirCreate($dir[$i])

...

...

Next

But if I try to create the new folders in a subfolder it doesn't work!

For $i=1 to 3

DirCreate("\folder1\folder2\$dir[$i]")

...

...

Next

Whats going wrong?

Berti

Link to comment
Share on other sites

Hi!

Try this:

For $i=1 to 3
DirCreate("\folder1\folder2\" & $dir[$i])
...
...
Next

Explanation:

In your case the array expression is not interpreted as it is in a string (determinated by the "). Now it is outside the string, is interpreted and the result is cancated with the first part of the dir to create (using &).

peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Link to comment
Share on other sites

Hi!

Of cours, no hard one.

If you insert a MsgBox with the parameter of the dricreate func you see that it has not been interpreted.

peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

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