My VB skills are rusty, so please excuse the lack of efficient code. I've attached the full script, and 3 sample files. My issue is running this code I will randomly get errors that should not be able to occur. For instance look at this following code section:
vTarget = fsoObj.GetFile("I:UsersJaridClientNameWithheldClientNameWithheld_ETLstaging emp_ci.csv")
If fsoObj.FileExists(vTarget) Then
vFile.Name = "temp_ci.csv"
The program will run through 5 or 9 or 22, etc. files. For the first 5 files (insert any other number here) the program runs without an issue. It will finally cycle through, but randomly it will give a "File Already Exists" error.
I have run this with multiple set ups (some it would delete at the end of the sub function...trying it at the beginning to account for the other error), but I would get similar errors (i.e. - "Permission Denied" during the delete step). Has anyone run into something like this before? Does anyone have any suggestions?