russellfowden
Technical User
I'm building a VBA app that processes and imports data from comma delimited files with a time/date stamp in the filename. These are automatically dropped into a holding directory at particular intervals, hence the potential for several to process sequentially. I'd like to maintain three folders - "received", "current" and "archive." New files would be dropped into "received" and have a filename format something like "file_ddmmyyyy-hh:mm:ss.csv." On a click event I'd like the following to happen:
1 - Several files may have been dropped into the "received" directory. I want to parse the filename, identify the one with the oldest timestamp (and probably pull the name into a variable) then put a copy of that file into the "archive" directory with the name unchanged.
2 - Copy the same file from "received" into "current" and rename it along the way to something like "nextin.csv".
3 - Run the parsing and insertion of the data through an API process (I've already finished this bit.)
4 - After successful processing delete the original csv from "received" and also the copy from "current."
I can't seem to find file handling objects that give me the tools I need to do stages 1,2 and 4. Does anyone happen to have any sample code or general approaches I could start with?
Many thanks,
Russ
1 - Several files may have been dropped into the "received" directory. I want to parse the filename, identify the one with the oldest timestamp (and probably pull the name into a variable) then put a copy of that file into the "archive" directory with the name unchanged.
2 - Copy the same file from "received" into "current" and rename it along the way to something like "nextin.csv".
3 - Run the parsing and insertion of the data through an API process (I've already finished this bit.)
4 - After successful processing delete the original csv from "received" and also the copy from "current."
I can't seem to find file handling objects that give me the tools I need to do stages 1,2 and 4. Does anyone happen to have any sample code or general approaches I could start with?
Many thanks,
Russ