great77

Using AND with FOR problem syntax error

3 posts in this topic

#1 ·  Posted

sleep(1000)
$avoid_overwrite = _FileListToArray("D:\Automation\A_List\aa_024", Default, 2)  ; the 2 is to return folders only

If @error Then Exit ;;;;;;;;MsgBox(0, "Error", "_FileListToArray returned @error = " & @error)
sleep(2000)

For $avoid_index = 1 to UBound($avoid_overwrite) - 1  And $parent = 1 To 100 Step 1



MsgBox(0, "Error", $avoid_overwrite[$avoid_index] & $parent&  @error)


DirMove("D:\Automation\A_List\aa_024\" & $avoid_overwrite[$avoid_index] , "D:\Automation\temp_process\" & $parent, 1)  

sleep(4000)

Next

I have a problem with using AND to help in looping moving the folders with  subfolders. The folders to move must maintain the structure and also am avoiding duplicate especially when Dirmove with 0(do not overwrite) is misbehaving. Can anyone tell me how I can use these 2 loop function becuase the FOR can not be nested. 

 

Help and suggestions highly appreciated 

Share this post


Link to post
Share on other sites



#2 ·  Posted

Increase $parent in the loop, like this :

Local $parent = 1

For $avoid_index = 1 to UBound($avoid_overwrite) - 1
    DirMove("D:\Automation\A_List\aa_024\" & $avoid_overwrite[$avoid_index] , "D:\Automation\temp_process\" & $parent, 1)
    $parent = $parent + 1
Next

 

Share this post


Link to post
Share on other sites

#3 ·  Posted

9 minutes ago, jguinch said:

Increase $parent in the loop, like this :

Local $parent = 1

For $avoid_index = 1 to UBound($avoid_overwrite) - 1
    DirMove("D:\Automation\A_List\aa_024\" & $avoid_overwrite[$avoid_index] , "D:\Automation\temp_process\" & $parent, 1)
    $parent = $parent + 1
Next

 

Wow. Thanks ! It works ! 

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