I have a batch script which first copies file from one location to other folder and then creates a list of name of the files in a text file:
COPY \\CDFS23001\\SOURCE\ORG\*ACCOUNTS*.xml \\CDFS23001\\SOURCE\TGT\
dir /b \\CDFS23001\\SOURCE\TGT\*ACCOUNTS*.xml > \\CDFS23001\\SOURCE\TGT\List_Accounts.txt
First copy command copies file from ORG folder to TGT folder and then a list of filename is created.
Sometimes the List_Accounts.txt doesnt have any name inspite of accounts file being present in ORG location.
Is it possible before the file(s) is (are) completely completely copied to TGT (destination) folder by COPY command the second command dir /b gets executed ?
If this is happening what can I do to have some wait time between these two commands ?
What I have tried:
I think Timeout 60 will create a time gap of 60 seconds, but in case if more time is required to copy files then it might fail too. The size of the files is never fixed.