Where did our files go?



  • This was a fun one. Until about a few weeks ago I have been on a few email chains and meetings where our outsources invoice files were no longer showing in our system when they needed to be reformatted. We were told by our EDI team that it was on the outsourcer's end and that they were working with them directly to fix it, and find out why the new files were not coming across the second time. I did not give it much thought after that.

     Fast forward a few weeks and my boss is running a report against our VSS db to identify changes for the release, when we came across this code highlighted that shed light on what was really going on:

                                     If File.Exists(strNewPath & strNewFileName) Then
                                        File.Delete(strUnzipFilePath & strFileName)
                                    Else
                                        File.Move(strUnzipFilePath & strFileName, strNewPath & strNewFileName)
                                        File.Copy(strNewPath & strNewFileName, strWebPath & strNewFileName)
                                    End If

    I think its code like this that ensures that I will always have a job somewhere.

    And yes, they did "fix" it, they copied and pasted the Move and Copy into the first If block...sigh



  • Thank you for making my eyes bleed this afternoon.



  •  Sorry, I don't get it? What exactly is happening here?



  • @donniel said:

     Sorry, I don't get it? What exactly is happening here?

    If the "new" file exists it deletes the "unzipped" file.

    Else move the "unzipped" file to the "new" file location then copy the "new" file to the "web" location.

    Since the "web" location is only referenced in the case that the "new" file does not exist it is possible that a file upload that should fall under the no "new" file case falls under the case where it does exist (like if a file that gets uploaded has the same name as one that was uploaded previously) we end up with no generation of the "web" file.



  • @Lingerance said:

    @donniel said:
     Sorry, I don't get it? What exactly is happening here?

    If the "new" file exists it deletes the "unzipped" file.

    Else move the "unzipped" file to the "new" file location then copy the "new" file to the "web" location.

    Since the "web" location is only referenced in the case that the "new" file does not exist it is possible that a file upload that should fall under the no "new" file case falls under the case where it does exist (like if a file that gets uploaded has the same name as one that was uploaded previously) we end up with no generation of the "web" file.
     

     exactly.... basically the file it was checking for, if it exists it deletes it, only when it does not exist does it create the file through the copy. So we had to run the process twice (once when it was supposed to run and once when the outsource told us the new file was sent) and suddenly our files would be there.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.