I have a folder A, which a user has put a new file into. My Javabatch program takes that file, manipulates it, and moves it into folder B. That works great.
A user then puts a new version of the same file into folder A. My program then takes that file, manipulates it, and tries to move it into folder B, which fails. Error code is 409, "A resource with this value already exists". That makes sense, because as I said, they specifically put the file into folder A with the same name as the last file they put in for processing, and was already moved to folder B.
What I need to know is, is it possible to move this file from folder A to folder B, overwriting the old file in the process. I don't care if the system counts this as a new file, or a new version of the old file. My main point is when the file is in folder A, I grab the file's ID and shared link and put it somewhere else in a database. And I need to make sure that the link and ID are maintained when the new file goes from folder A to folder B. If an overwrite isn't possible, what's the best way to delete the file in folder B before moving the new file from folder A to folder B?
Please sign in to leave a comment.