BrianTheLibrarian

Error using FileMove

3 posts in this topic

Hello I am trying to use FileMove to rename 1500 or so svg files I have.  Here is the code I have put together.

$len = UBound($name)

$x = 0
_ArrayDisplay ($name)

while $x < $len
    FileMove($Directory & "\" & $name[$x][0]&".svg", $Directory & "\" & $name[$x][1]&".svg" )
     $x = $x+1
wend

 

When I run it I get the error:

"Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded."

Thanks for any suggestions.

Brian

Share this post


Link to post
Share on other sites



Use:

$len = UBound($name)-1 ;Array is 0 based so 50 elements are element 0 to 49 but you try 0 to 50

$x = 0
_ArrayDisplay ($name)

while $x < $len
    FileMove($Directory & "\" & $name[$x][0]&".svg", $Directory & "\" & $name[$x][1]&".svg" )
     $x = $x+1
wend

 

1 person likes this

Share this post


Link to post
Share on other sites

Thank you AutoBert that solved it for me!

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