"Index was our of range.Must be non negative "

Hi all,

while using Move File Activity throwing error like

Index was out of range. Must be non-negative and less than the size of the collection. Parameter name :index

Can any one help me out with this

Thanks in advance.

I’m downloading and moving those files and suddenly came across this error.

Hi @saritha are you giving write path ?

S ,I’m giving right path only. Its moving some files and suddenly not able to move file and throwing this error.


@saritha are you giving file path hard coded or some generic method

hard coded
From: Directory.GetFiles
To: filepath

Are any of the files empty?

@saritha your way is correct, Recently I used this activity but i did not face any issue
You array is accessing that point which is not present or initialize, show me code how you are using move activity

Index was out of range usually means that you’re referencing an array item that doesn’t exist. Like myArray(5) but there are only two items in the array. Are you directly referencing an array index in your Move File activity?

its not empty, As soon as it downloads files it moves to Share Drive

are you using share point activities?

no just Move File Activity only.

40 files moves and got stuck with next file which already downloaded in Downloads

Do I need to give some wait time to move the file like Delay before Move file


@saritha please move manually one that file on which bot is giving error and check what happen

u mean I have to move manually from Downloads to Shared Drive ?

yes move back to back 2 3 files just for test

I couldn’t move that file because of same file existed in Shared Folder.

Its asking whether i Have to Replace or Skip it

Its not issue you have mark over write already in activity. Try with delay maybe file is taking time

ok thanks will try tomorrow and update u.

Thanks a lot and Happy weekend

@saritha Happy weekend. Happy learning, sure we will discuss, give me vote :joy:

1 Like

may I know how to vote

@saritha vote means like

1 Like