How to get 2 files of same format from downloads folder to 2 different folder?

I am downloading files from 2 different database and it is having same file format. I want to rename this files and transfer it to 2 different folders but I am unable to get it in the particular folder. For e.g If I download 2 files from a database A and 1 file from database B then I want to transfer this files in different folder but the issue is that database A has 2 files so I am able to rename one file and transfer it in the particular folder but the 2nd file from database A is getting renamed different i.e getting renamed with the folder name of database B. and getting transferred to database B folder instead of Database A folder.

@Rahul_D

Can you please show how you are trying it,may be that way we can help

cheers



After downloading I am renaming it and tranfering it to the folder

You need to move the increment of the counter inside the loop, after renaming the file:

Also, what is this for ?

image