So, I'm automating a payment import system, writing the whole thing from scratch. It has to pull data from excel files (including extraneous data that we need to discard), process it, and insert it into a database. Oddly, those aspects are going quite well. However, I'm running into a problem selecting the files that I need to import.

Now, since each file name has some variation of the date in it, I started working by parsing the date out of it, and then checking to see if it was more recent that the date stored in my config file. However, since the filenames are irregular, that's not going to work elegantly. The only way I can see to keep that working involves an ugly if-else chain.

A friend suggested that I just add a couple of tables to the database and keep track of ALL the files I've ever added to it, in addition to the data itself. That seems kind of cruft-ey to me.

Does anyone have an idea better than "store all the files you've ever used" or "have an ugly if-else tree"? If you do, it would be much appreciated!

is checking for the date modified or created of the file an option? At least using those dates the format is set and you're not relying on user input to determine if you want to operate on that file.

If you set up a specific folder for files to process then users can deposit completed files into that folder. Once you have processed a file you can move it out of that folder and archive or delete it. Sometimes you just have to train the users to provide data in the proper format in a file with a properly formatted name. I find a cattle prod works well.

Thanks hericles, Reverend Jim. More ideas to be stirred into the pot.


This question has already been answered. Start a new discussion instead.